Skip to content

docs: explain how to publish Mercure updates from php-cli - #2718

Merged
henderkes merged 1 commit into
mainfrom
docs/mercure-cli
Oct 18, 2026
Merged

henderkes merged 1 commit into
mainfrom
docs/mercure-cli

Conversation

@dunglas

@dunglas dunglas commented Oct 16, 2026

Copy link
Copy Markdown
Member

mercure_publish() doesn't exist in frankenphp php-cli: the CLI process doesn't load Caddy, so there is no hub to publish to. Commands (cron jobs, queue consumers) must use the POST endpoint of the hub instead.

This documents it, warns against detecting mercure_publish() while building the container or warming caches (Symfony, Laravel and others do this in CLI, which freezes false into the cache and disables the function in the web server too), and states that the publisher block is what enables the POST endpoint.

@dunglas
dunglas marked this pull request as ready for review October 16, 2026 12:05
dunglas added a commit that referenced this pull request Oct 16, 2026
Registers `frankenphp_log()` and the `FRANKENPHP_LOG_LEVEL_*` constants
in the `frankenphp-cli` module, so code shared between web requests and
commands can log the same way.

- `ExecuteScriptCLI()` accepts the `WithLogger` and `WithContext`
options (variadic, existing callers still compile).
- `frankenphp php-cli` passes Caddy's default logger, so CLI entries
have the same format and `logger` name as the server's, written to
stderr. The `Caddyfile` isn't loaded, so its `log` directives don't
apply.

`mercure_publish()` stays unavailable in CLI, see
#2718.
@henderkes
henderkes merged commit f6bb84b into main Oct 18, 2026
30 checks passed
@henderkes
henderkes deleted the docs/mercure-cli branch October 18, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants