diff --git a/PhpStormStubsMap.php b/PhpStormStubsMap.php index 00edcdf55..10c32c324 100644 --- a/PhpStormStubsMap.php +++ b/PhpStormStubsMap.php @@ -2662,6 +2662,7 @@ final class PhpStormStubsMap 'fputs' => 'standard/standard_5.php', 'frankenphp_finish_request' => 'frankenphp/frankenphp.php', 'frankenphp_handle_request' => 'frankenphp/frankenphp.php', + 'frankenphp_log' => 'frankenphp/frankenphp.php', 'frankenphp_request_headers' => 'frankenphp/frankenphp.php', 'frankenphp_response_headers' => 'frankenphp/frankenphp.php', 'fread' => 'standard/standard_5.php', @@ -3989,6 +3990,7 @@ final class PhpStormStubsMap 'memory_get_peak_usage' => 'standard/standard_4.php', 'memory_get_usage' => 'standard/standard_4.php', 'memory_reset_peak_usage' => 'standard/standard_4.php', + 'mercure_publish' => 'frankenphp/frankenphp.php', 'metaphone' => 'standard/standard_8.php', 'method_exists' => 'Core/Core.php', 'mhash' => 'hash/hash.php', @@ -7779,6 +7781,10 @@ final class PhpStormStubsMap 'FPE_INTDIV' => 'pcntl/pcntl.php', 'FPE_INTOVF' => 'pcntl/pcntl.php', 'FRAC_DIGITS' => 'standard/standard_defines.php', + 'FRANKENPHP_LOG_LEVEL_DEBUG' => 'frankenphp/frankenphp.php', + 'FRANKENPHP_LOG_LEVEL_ERROR' => 'frankenphp/frankenphp.php', + 'FRANKENPHP_LOG_LEVEL_INFO' => 'frankenphp/frankenphp.php', + 'FRANKENPHP_LOG_LEVEL_WARN' => 'frankenphp/frankenphp.php', 'FTA_BOLD' => 'winbinder/winbinder.php', 'FTA_ITALIC' => 'winbinder/winbinder.php', 'FTA_NORMAL' => 'winbinder/winbinder.php', diff --git a/frankenphp/frankenphp.php b/frankenphp/frankenphp.php index cc8f61dc5..03d7487da 100644 --- a/frankenphp/frankenphp.php +++ b/frankenphp/frankenphp.php @@ -56,3 +56,26 @@ function frankenphp_request_headers(): array {} * @return array|false An array of all FrankenPHP response headers on success or FALSE on failure. */ function frankenphp_response_headers(): array|false {} + +/** + * Publishes a Mercure update to all currently connected subscribers. + * + * @link https://frankenphp.dev/docs/mercure/ + * @link https://mercure.rocks + * + * @param string|string[] $topics + */ +function mercure_publish(string|array $topics, string $data = '', bool $private = false, ?string $id = null, ?string $type = null, ?int $retry = null): string {} + +const FRANKENPHP_LOG_LEVEL_DEBUG = -4; +const FRANKENPHP_LOG_LEVEL_INFO = 0; +const FRANKENPHP_LOG_LEVEL_WARN = 4; +const FRANKENPHP_LOG_LEVEL_ERROR = 8; + +/** + * Emits a structured log record with the current time and the given message, level and context. + * + * @param int $level The importance or severity of a log event. The higher the level, the more important or severe the event. For more details, see: https://pkg.go.dev/log/slog#Level + * array $context Values of the array will be converted to the corresponding Go type (if supported by FrankenPHP) and added to the context of the structured logs using https://pkg.go.dev/log/slog#Attr + */ +function frankenphp_log(string $message, int $level = FRANKENPHP_LOG_LEVEL_INFO, array $context = []): void {}