symfony/mercure
Symfony Mercure Component
v0.8.0
18M downloads/mo
#841 most downloaded on Packagist
symfony/mercure
What this package is like to depend on
Last release 12 days ago
11 Aug 2026
Release timing varies
gaps range from 8 days to 1.6 years
Nearly every release is documented
notes for 18 of 19 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
19 releases · first in 2018
4 releases in the last 12 months
see the full history below
Release timeline
19 releases · Oct 2018 to Aug 2026
2019
2020
2021
2022
2023
2024
2025
2026
Releases
latest 19-
v0.8.011 Aug 2026Release notes
Open source →- Add support for the Mercure protocol 1.0, alongside the existing 0.x protocol (
Symfony\Component\Mercure\ProtocolVersion, opt-in per hub,0.xstays the default until Mercure hub 1.0 is tagged stable) - Add
HubInterface::getProtocolVersion()andHubInterface::getCookieName() - Add
Hub/FrankenPhpHub/MockHubconstructor parameters$cookieNameand$protocolVersion - Change the default subscriber authorization cookie name to
__Secure-mercure_access_tokenwhen a hub is configured for protocol 1.0 (mercureAuthorizationstays the default for 0.x); the__Secure-/__Host-prefix contract itself is enforced bySymfony\Component\HttpFoundation\Cookie(symfony/symfony#65162);Authorizationadditionally fails early, with a hint to configure a prefix-less cookie name, when a prefixed name meets a plain-HTTP hub URL (where browsers would silently drop the cookie) - Add Mercure protocol 1.0 support (the
authorization_detailsclaim, an RFC 9068 access token,at+jwt) toSymfony\Component\Mercure\Jwt\LcobucciFactory, selected via its new$protocolVersionconstructor parameter - Add
Symfony\Component\Mercure\Jwt\WebTokenFactory, aweb-token/jwt-library-based alternativeTokenFactoryInterfaceimplementation for the Mercure protocol 1.0. It names algorithms by their JWA name (HS256,ES256,EdDSA, …), unlikeLcobucciFactory'shmac.sha256style, and supports RSA-PSS (PS256/PS384/PS512) and Ed25519 (EdDSA) on top of the HMAC/ECDSA/RSA algorithms both factories share - Its constructor takes a
Jose\Component\Signature\JWSBuilderand aJose\Component\Core\JWK, soweb-token/jwt-bundle'sjose.jws_builder.*andjose.key.*services can be wired in directly;WebTokenFactory::fromSecret()andfromJwksUri()build both from a secret instead - Add
WebTokenFactory::fromJwksUri(), fetching the signing key from a JSON Web Key Set (JWKS) endpoint instead of a static secret, useful when key material is rotated by an external key server; the selected key is not refreshed for the lifetime of the factory instance, see the method's docblock for the tradeoff under persistent-worker deployments - Allow
TokenFactoryInterface::create()'s$subscribe/$publishparameters, and the Twigmercure()function's$topicsparameter andsubscribe/publishoptions, to be an associative array mapping a topic matcher type (exact,urlpattern, or a registered extension type) to a list of patterns, in addition to the existing flat topic list - Replace
FactoryTokenProvider's$subscribe/$publishconstructor parameters with$grants(aGrant[]list) and a new$additionalClaimsparameter, both forwarded to the wrapped factory Symfony\Component\Mercure\Jwt\LcobucciFactory::create()now throws anInvalidArgumentExceptiondescribing the 0.8 signature change when called with the pre-0.8 convention (non-Grantelements in$grants, or an integer-keyed$additionalClaims), instead of silently minting a token with dropped grants or a lostexp- Add
Symfony\Component\Mercure\Jwt\DefaultClaimsTokenFactory, aTokenFactoryInterfacedecorator merging in a fixed set of claims (e.g. a hub'siss/aud/sub/client_id) soAuthorizationand the Twigmercure()function, which callHubInterface::getFactory()directly, get them without repeating them on every call - Add
Symfony\Component\Mercure\Jwt\Grant(actions/topics/payload), replacingTokenFactoryInterface::create()'s$subscribe/$publishparameters and theadditionalClaims['mercure']['payload']bag key; a singleGrantcan now carry bothsubscribeandpublishactions over the same topics, producing oneauthorization_detailsentry instead of two, and apayloadis validated (requires a topic, only meaningful with thesubscribeaction) instead of silently colliding with the legacymercureclaim's own use of the same key - Model
Authorization::createCookie()/setCookie()directly onGrant:$subscribeis renamed$grantsand now also accepts aGrant[]list or a bare topic string, in addition to its previous flat-topic-list/matcher-map shapes ($payloadfolds intoGrant's own constructor and is dropped as a separate parameter);$publishis deprecated in favor of adding aGrant::ACTION_PUBLISHGrant to$grants, and passingnullfor$grantsis deprecated in favor of[]. The$subscribe→$grantsrename breaks named-argument calls usingsubscribe:specifically — positional calls andpublish:/additionalClaims:/hub:named args are unaffected. The Twigmercure()function gains a matchinggrantsoption; its existingsubscribe/publish/payloadoptions are unaffected (translated internally the same way) - Add
MatcherInput::normalizeGrants(), the shared logic now backing bothAuthorization::$grantsand the Twiggrantsoption; besidesGrant[]and the topic shorthands, it also accepts a list of Grant-shaped associative arrays (actions/topics/payload), letting contexts that can't construct aGrantobject directly (e.g. a Twig template) still express multi-action or payload-bearing grants Symfony\Component\Mercure\Jwt\LcobucciFactoryno longer forces integerexp/iat/nbfunder protocol 1.0; a resource server is expected to accept RFC 9068'sNumericDateas either an integer or a float carrying sub-second precision,lcobucci/jwt's own default- Require PHP 8.2, up from 8.1:
web-token/jwt-library, needed byWebTokenFactory, requires it
Release notes
Open source →- Add support for the Mercure protocol 1.0, alongside the existing 0.x protocol (
Symfony\Component\Mercure\ProtocolVersion, opt-in per hub,0.xstays the default until Mercure hub 1.0 is tagged stable) - Add
HubInterface::getProtocolVersion()andHubInterface::getCookieName() - Add
Hub/FrankenPhpHub/MockHubconstructor parameters$cookieNameand$protocolVersion - Change the default subscriber authorization cookie name to
__Secure-mercure_access_tokenwhen a hub is configured for protocol 1.0 (mercureAuthorizationstays the default for 0.x); the__Secure-/__Host-prefix contract itself is enforced bySymfony\Component\HttpFoundation\Cookie(symfony/symfony#65162);Authorizationadditionally fails early, with a hint to configure a prefix-less cookie name, when a prefixed name meets a plain-HTTP hub URL (where browsers would silently drop the cookie) - Add Mercure protocol 1.0 support (the
authorization_detailsclaim, an RFC 9068 access token,at+jwt) toSymfony\Component\Mercure\Jwt\LcobucciFactory, selected via its new$protocolVersionconstructor parameter - Add
Symfony\Component\Mercure\Jwt\WebTokenFactory, aweb-token/jwt-library-based alternativeTokenFactoryInterfaceimplementation for the Mercure protocol 1.0. It names algorithms by their JWA name (HS256,ES256,EdDSA, …), unlikeLcobucciFactory'shmac.sha256style, and supports RSA-PSS (PS256/PS384/PS512) and Ed25519 (EdDSA) on top of the HMAC/ECDSA/RSA algorithms both factories share - Its constructor takes a
Jose\Component\Signature\JWSBuilderand aJose\Component\Core\JWK, soweb-token/jwt-bundle'sjose.jws_builder.*andjose.key.*services can be wired in directly;WebTokenFactory::fromSecret()andfromJwksUri()build both from a secret instead - Add
WebTokenFactory::fromJwksUri(), fetching the signing key from a JSON Web Key Set (JWKS) endpoint instead of a static secret, useful when key material is rotated by an external key server; the selected key is not refreshed for the lifetime of the factory instance, see the method's docblock for the tradeoff under persistent-worker deployments - Allow
TokenFactoryInterface::create()'s$subscribe/$publishparameters, and the Twigmercure()function's$topicsparameter andsubscribe/publishoptions, to be an associative array mapping a topic matcher type (exact,urlpattern, or a registered extension type) to a list of patterns, in addition to the existing flat topic list - Replace
FactoryTokenProvider's$subscribe/$publishconstructor parameters with$grants(aGrant[]list) and a new$additionalClaimsparameter, both forwarded to the wrapped factory Symfony\Component\Mercure\Jwt\LcobucciFactory::create()now throws anInvalidArgumentExceptiondescribing the 0.8 signature change when called with the pre-0.8 convention (non-Grantelements in$grants, or an integer-keyed$additionalClaims), instead of silently minting a token with dropped grants or a lostexp- Add
Symfony\Component\Mercure\Jwt\DefaultClaimsTokenFactory, aTokenFactoryInterfacedecorator merging in a fixed set of claims (e.g. a hub'siss/aud/sub/client_id) soAuthorizationand the Twigmercure()function, which callHubInterface::getFactory()directly, get them without repeating them on every call - Add
Symfony\Component\Mercure\Jwt\Grant(actions/topics/payload), replacingTokenFactoryInterface::create()'s$subscribe/$publishparameters and theadditionalClaims['mercure']['payload']bag key; a singleGrantcan now carry bothsubscribeandpublishactions over the same topics, producing oneauthorization_detailsentry instead of two, and apayloadis validated (requires a topic, only meaningful with thesubscribeaction) instead of silently colliding with the legacymercureclaim's own use of the same key - Model
Authorization::createCookie()/setCookie()directly onGrant:$subscribeis renamed$grantsand now also accepts aGrant[]list or a bare topic string, in addition to its previous flat-topic-list/matcher-map shapes ($payloadfolds intoGrant's own constructor and is dropped as a separate parameter);$publishis deprecated in favor of adding aGrant::ACTION_PUBLISHGrant to$grants, and passingnullfor$grantsis deprecated in favor of[]. The$subscribe→$grantsrename breaks named-argument calls usingsubscribe:specifically — positional calls andpublish:/additionalClaims:/hub:named args are unaffected. The Twigmercure()function gains a matchinggrantsoption; its existingsubscribe/publish/payloadoptions are unaffected (translated internally the same way) - Add
MatcherInput::normalizeGrants(), the shared logic now backing bothAuthorization::$grantsand the Twiggrantsoption; besidesGrant[]and the topic shorthands, it also accepts a list of Grant-shaped associative arrays (actions/topics/payload), letting contexts that can't construct aGrantobject directly (e.g. a Twig template) still express multi-action or payload-bearing grants Symfony\Component\Mercure\Jwt\LcobucciFactoryno longer forces integerexp/iat/nbfunder protocol 1.0; a resource server is expected to accept RFC 9068'sNumericDateas either an integer or a float carrying sub-second precision,lcobucci/jwt's own default- Require PHP 8.2, up from 8.1:
web-token/jwt-library, needed byWebTokenFactory, requires it
- Add support for the Mercure protocol 1.0, alongside the existing 0.x protocol (
-
v0.7.215 Dec 2025Release notes
Open source →0.7.2
- Revert lazy-loading the Twig extension to fix compatibility with Symfony 6.4
Release notes
Open source →- Revert lazy-loading the Twig extension to fix compatibility with Symfony 6.4
-
v0.7.121 Nov 2025 -
v0.7.021 Nov 2025Release notes
Open source →- Add support for FrankenPHP's
mercure_publish()function - Compatibility with Symfony 8
- Lazy-load the Twig extension
- Drop support for unmaintained PHP and Symfony versions
Release notes
Open source →- Add support for FrankenPHP's
mercure_publish()function - Compatibility with Symfony 8
- Lazy-load the Twig extension
- Drop support for unmaintained PHP and Symfony versions
- Add support for FrankenPHP's
-
v0.6.508 Apr 2024Release notes
Open source →What's Changed
- Fix compatibility of last event ID with the latest version of the spec by @dunglas in #114
- Explicitly mark nullable parameters as nullable by @xabbuh in #113
New Contributors
Full Changelog: v0.6.4...v0.6.5
-
v0.6.403 Dec 2023 -
v0.6.306 Mar 2023 -
v0.6.223 Nov 2022Release notes
Open source →- Always set the
Content-TypeHTTP header toapplication/x-www-form-urlencodedwhen sending an update to the hub Symfony\Component\Mercure\Messenger\UpdateHandlernow returns the ID of the published update- Allow passing
nullas$subscribeand$publishparameters inSymfony\Component\Mercure\Jwt\TokenFactoryInterface - Add a new optional parameter in
Symfony\Component\Mercure\Authorization::__construct()to set theSameSitecookie attribute
Release notes
Open source →- Always set the
Content-TypeHTTP header toapplication/x-www-form-urlencodedwhen sending an update to the hub Symfony\Component\Mercure\Messenger\UpdateHandlernow returns the ID of the published update- Allow passing
nullas$subscribeand$publishparameters inSymfony\Component\Mercure\Jwt\TokenFactoryInterface - Add a new optional parameter in
Symfony\Component\Mercure\Authorization::__construct()to set theSameSitecookie attribute
- Always set the
-
v0.6.116 Dec 2021Release notes
Open source →- Allow passing additional data to the
mercureJWT claim when usingSymfony\Component\Mercure\Token\LcobucciFactory - Add a new
passphraseargument toSymfony\Component\Mercure\Token\LcobucciFactoryallowing the use of encrypted keys - Add a new
lastEventIdoption to themercure()Twig function to set theLast-Event-IDquery parameter - Fix a bug preventing setting cookies for legit subdomains when using
Symfony\Component\Mercure\Authorization::createCookie() - Fix bug in
Symfony\Component\Mercure\Token\LcobucciFactorythat results in a runtime error when using "ecdsa" algorithms, alongside "lcobucci/jwt:^4.0"
Release notes
Open source →- Allow passing additional data to the
mercureJWT claim when usingSymfony\Component\Mercure\Token\LcobucciFactory - Add a new
passphraseargument toSymfony\Component\Mercure\Token\LcobucciFactoryallowing the use of encrypted keys - Add a new
lastEventIdoption to themercure()Twig function to set theLast-Event-IDquery parameter - Fix a bug preventing setting cookies for legit subdomains when using
Symfony\Component\Mercure\Authorization::createCookie() - Fix bug in
Symfony\Component\Mercure\Token\LcobucciFactorythat results in a runtime error when using "ecdsa" algorithms, alongside "lcobucci/jwt:^4.0"
- Allow passing additional data to the
-
v0.6.012 Oct 2021Release notes
Open source →- Add
mercure()Twig function to generate URLs of the hubs and set the authorization cookies - Add
Authorization::setCookie()to ease setting authorization cookies - Add
Authorization::clearCookie()to remove themercureAuthorizationcookie from the browser - Fix the domain check in
Authorization::createCookie()to allow subdomains - Compatibility with Symfony 6 and Symfony Contracts 3
Release notes
Open source →- Add
mercure()Twig function to generate URLs of the hubs and set the authorization cookies - Add
Authorization::setCookie()to ease setting authorization cookies - Add
Authorization::clearCookie()to remove themercureAuthorizationcookie from the browser - Fix the domain check in
Authorization::createCookie()to allow subdomains - Compatibility with Symfony 6 and Symfony Contracts 3
- Add
-
v0.5.304 Apr 2021 -
v0.5.203 Apr 2021Release notes
Open source →- Set a default expiration for the JWT and the cookie when using the
Authorizationclass
- Set a default expiration for the JWT and the cookie when using the
-
v0.5.131 Mar 2021 -
v0.5.022 Mar 2021Release notes
Open source →- Added
Symfony\Component\Mercure\Jwt\TokenProviderInterface - Added
Symfony\Component\Mercure\Jwt\TokenFactoryInterface - Added
Symfony\Component\Mercure\Jwt\StaticTokenProvider - Added
Symfony\Component\Mercure\Jwt\CallabkeTokenProvider - Added
Symfony\Component\Mercure\Jwt\LcobucciTokenFactory - Added
Symfony\Component\Mercure\Jwt\FactoryTokenProvider - Added
Symfony\Component\Mercure\Messenger\UpdateHandler - Added
Symfony\Component\Mercure\Hub - Added
Symfony\Component\Mercure\HubInterface - Added
Symfony\Component\Mercure\HubRegistry - Added
Symfony\Component\Mercure\Discovery - Added
Symfony\Component\Mercure\Authorization - Deprecated
Jwt\StaticJwtProvider, useJwt\StaticTokenProviderinstead. - Deprecated
PublisherInterfaceinterface in favor ofHubInterface. - Deprecated
Publisherclass in favor ofHub. - Deprecated
Debug\TraceablePublisherclass in favor ofDebug\TraceableHub.
- Added
-
v0.4.126 Nov 2020 -
v0.4.027 May 2020 -
v0.3.008 Nov 2019Release notes
Open source →- Compatibility with Symfony 5
- Add
TraceablePublisherto collect debug information - Add
PublisherInterface - Fix an error when using the
retryparameter
-
v0.2.020 Jun 2019 -
v0.1.024 Oct 2018Nothing published for this version