friendsofsymfony/http-cache
Tools to manage HTTP caching proxies with PHP
3.2.0
16M downloads/mo
#1569 most downloaded on Packagist
FriendsOfSymfony/FOSHttpCache
What this package is like to depend on
Last release 5 months ago
04 Mar 2026
Release timing varies
gaps range from 9 days to 11 months
Nearly every release is documented
notes for 56 of 60 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
70 releases · first in 2014
2 releases in the last 12 months
see the full history below
Release timeline
69 releases · Mar 2014 to Mar 2026Releases
latest 60 of 70-
3.2.004 Mar 2026Release notes
Open source →- Added support for prefix invalidation, a special case of banning for cloudflare enterprise.
Release notes
Open source →- Added support for prefix invalidation, a special case of banning for cloudflare enterprise.
-
3.1.203 Dec 2025 -
3.1.117 Jun 2025Release notes
Open source →Varnish Cache
- Fixed
banPathto escape array of host names to be a correct regular expression.
Release notes
Open source →Varnish Cache
- Fixed
banPathto escape array of host names to be a correct regular expression.
- Fixed
-
3.1.024 Jul 2024Release notes
Open source →Symfony HttpCache
- Add events
PRE_FORWARDandPOST_FORWARDto allow event listeners to alter
the request before and after it is sent to the backend. - Changed CustomTtlListener to use the
POST_FORWARDevent instead of
PRE_STORE. UsingPRE_STORE, requests that are not considered cacheable by
Symfony were never cached, even when they had a custom TTL header. - Add flag
fallbackToSmaxagetoCustomTtlListenerto allow controlling
fallback tos-maxageif custom TTL header is not defined on the response. - Fix: Do not call store if Response object is not longer cacheable after event
listeners. If you use the custom TTL system, this is only a performance
improvement, because the TTL of the response would still be 0. With a custom
listener that changes the response explicitly to not be cached but does not
changes-maxage, this bug might have led to caching responses that should not
have been cached.
Release notes
Open source →Symfony HttpCache
- Add events
PRE_FORWARDandPOST_FORWARDto allow event listeners to alter the request before and after it is sent to the backend. - Changed CustomTtlListener to use the
POST_FORWARDevent instead ofPRE_STORE. UsingPRE_STORE, requests that are not considered cacheable by Symfony were never cached, even when they had a custom TTL header. - Add flag
fallbackToSmaxagetoCustomTtlListenerto allow controlling fallback tos-maxageif custom TTL header is not defined on the response. - Fix: Do not call store if Response object is not longer cacheable after event
listeners. If you use the custom TTL system, this is only a performance
improvement, because the TTL of the response would still be 0. With a custom
listener that changes the response explicitly to not be cached but does not
change
s-maxage, this bug might have led to caching responses that should not have been cached.
- Add events
-
3.0.004 May 2024Release notes
Open source →- Support Symfony 7
- Drop support for Symfony < 6.4
- Test with PHP 8.2 and 8.3
- Drop support for PHP < 8.1
- Switched to PSR-17 message factories
- Switched some places to PSR-18 HTTP client. The main functionality needs the Httplug Async Client specification. There is no PSR for asynchronous clients.
- Parameter and return type declarations where possible.
- Ignore empty tag lists passed to
TagCapable::invalidateTagsso you don't need to check if there are tags or not.
Release notes
Open source →- Support Symfony 7
- Drop support for Symfony < 6.4
- Test with PHP 8.2 and 8.3
- Drop support for PHP < 8.1
- Switched to PSR-17 message factories
- Switched some places to PSR-18 HTTP client. The main functionality needs the Httplug Async Client specification. There is no PSR for asynchronous clients.
- Parameter and return type declarations where possible.
- Ignore empty tag lists passed to
TagCapable::invalidateTagsso you don't need to check if there are tags or not.
2.x
-
2.16.202 Aug 2024Release notes
Open source →Fixed
- The new
EventDispatchingHttpCache::forwardmethod added in 2.16.0 was not
compatible with Symfony 4.4. Adjusted the signature to make it compatible.
Release notes
Open source →Fixed
- The new
EventDispatchingHttpCache::forwardmethod added in 2.16.0 was not compatible with Symfony 4.4. Adjusted the signature to make it compatible.
- The new
-
2.16.124 Jul 2024 -
2.16.024 Jul 2024Release notes
Open source →Symfony HttpCache
- Add events
PRE_FORWARDandPOST_FORWARDto allow event listeners to alter
the request before and after it is sent to the backend. - Changed CustomTtlListener to use the
POST_FORWARDevent instead of
PRE_STORE. UsingPRE_STORE, requests that are not considered cacheable by
Symfony were never cached, even when they had a custom TTL header. - Add flag
fallbackToSmaxagetoCustomTtlListenerto allow controlling
fallback tos-maxageif custom TTL header is not defined on the response. - Fix: Do not call store if Response object is not longer cacheable after event
listeners. If you use the custom TTL system, this is only a performance
improvement, because the TTL of the response would still be 0. With a custom
listener that changes the response explicitly to not be cached but does not
changes-maxage, this bug might have led to caching responses that should not
have been cached.
Release notes
Open source →Symfony HttpCache
- Add events
PRE_FORWARDandPOST_FORWARDto allow event listeners to alter the request before and after it is sent to the backend. - Changed CustomTtlListener to use the
POST_FORWARDevent instead ofPRE_STORE. UsingPRE_STORE, requests that are not considered cacheable by Symfony were never cached, even when they had a custom TTL header. - Add flag
fallbackToSmaxagetoCustomTtlListenerto allow controlling fallback tos-maxageif custom TTL header is not defined on the response. - Fix: Do not call store if Response object is not longer cacheable after event
listeners. If you use the custom TTL system, this is only a performance
improvement, because the TTL of the response would still be 0. With a custom
listener that changes the response explicitly to not be cached but does not
change
s-maxage, this bug might have led to caching responses that should not have been cached.
- Add events
-
2.15.311 Dec 2023 -
2.15.230 Nov 2023Release notes
Open source →- Declare incompatibility with Symfony 7 because it removes
RequestMatcher.
Release notes
Open source →- Declare incompatibility with Symfony 7 because it removes
RequestMatcher.
- Declare incompatibility with Symfony 7 because it removes
-
2.15.117 May 2023Release notes
Open source →- Directly require
php-http/message-factoryto keep working with the legacy factories.
- Directly require
-
2.15.001 Dec 2022Release notes
Open source →- Provide a
TagHeaderParserthat can split up a tag header into the list of tags. This allows to correctly handle non-default tag separators in all places.
- Provide a
-
2.14.202 Nov 2022Release notes
Open source →- Fixed varnish configuration examples to say
Authorizationand notAutorization.
- Fixed varnish configuration examples to say
-
2.14.107 Jul 2022Release notes
Open source →- Fixed dummy interface name for code scanners to match the expected name.
-
2.14.006 Jul 2022Release notes
Open source →Symfony Compatibility
- Removed the internal BaseEvent class and extend our events from the Symfony contracts class directly.
- Made the CacheInvalidation interface compatible with Symfony 6.
Symfony 6 does a BC break for
HttpKernelInterface::fetch- if you implement the method in your application, you need to adjust when upgrading to Symfony 6.
-
2.13.025 Jan 2022Release notes
Open source →- Allow installation with Symfony 6 components
- Drop support for Symfony 3, minimal version is now 4.3
-
2.12.116 Mar 2022Release notes
Open source →Symfony Compatibility
- Do not extend the wrong Event class when installed with legacy Symfony but the Symfony contracts happen to be installed
-
2.12.012 Jan 2022Release notes
Open source →Cloudflare
- Added Cloudflare ProxyClient Adapter with ClearCapable, PurgeCapable and TagCapable. This allows to use FOSHttpCache to invalidate caches on Cloudflare. See the "Proxy Client" section of the documentation for how to configure the Cloudflare client.
Varnish Cache
- Added a
fos_user_context_hashmethod to be called invcl_hashwhen using the user context hash mechanism. This can avoid performance problems Varnish can run into when the hashVarys on the basic authentication or session cookie. If you use the user context, read the updated documentation and callfos_user_context_hashin yourvcl_hashfunction.
Noop Client
- Implemented ClearCapable.
-
2.11.030 Sep 2021Release notes
Open source →Symfony HttpCache
- Added flag on CustomTtlListener to allow keeping the custom TTL header on the response
Fastly client
- Marked the
@internalconstants inFOS\HttpCache\ProxyClient\Fastlyas private
-
2.10.128 Jun 2021Release notes
Open source →HttpDispatcher
- Fix how we create exceptions to get the expected exception rather than a PHP error
-
2.10.002 Dec 2020Release notes
Open source →General
- Raised minimal PHP version to 7.2
- Added support for PHP 8.0
Symfony HttpCache
- Added a neutral "Bad Request" body to user hash mismatch response to have something searchable in the code when debugging.
-
2.9.219 May 2020Release notes
Open source →Proxy Client
- Fix: Preserve inline credentials when multiplexing to the proxy servers.
-
2.9.107 May 2020Release notes
Open source →Proxy Client
- Allow to use inline credentials for the caching proxy URL in the format http://user:[email protected]
-
2.9.005 Feb 2020Release notes
Open source →General
- Raised minimal PHP version to 7.1
- Test helper classes upgraded to support PHPUnit 7/8
- There is no php-http/discovery package 2.0, drop it from composer.json
- Adapt for changes to NetworkException in HTTPlug 2.1 for PSR-18 compatibility
Symfony HttpCache
- Fixed issue with
PurgeTagsListenerand Symfony 5 - Fixed clearing the cache completely together with toflar psr6 store did not work
-
2.8.027 Nov 2019Release notes
Open source →General
- Support Symfony 5
- Use
LegacyEventDispatcherProxyfor Symfony >= 4.3 to avoid deprecation messages. - Added Fastly ProxyClient Adapter with ClearCapable, PurgeCapable, RefreshCapable, & TagCapable. Fastly is a CDN originally based on Varnish 2.x, so with many of the same capabilities like VCL and more.
-
2.7.014 May 2019 -
2.6.029 Apr 2019Release notes
Open source →General
- Added: ClearCapable to clear the whole cache in one efficient call. Currently supported only by the Symfony HttpCache.
- Allow installing with Httplug 2.0 / PSR-18.
-
2.5.431 Oct 2018Release notes
Open source →Symfony HttpCache
- Fixed: Avoid regression of 2.5.3: If there are no messages to be dispatched, do not throw an exception if the HttpCache is not set.
-
2.5.331 Oct 2018Release notes
Open source →Symfony HttpCache
- Fixed: Handle HttpCache not available in KernelDispatcher and fix return type annotations - if HttpCache is not set, it can't be returned.
-
2.5.203 Oct 2018Release notes
Open source →Varnish
- Fixed: Remove the xkey header in vcl_deliver if we are not in debug mode
- Do not cleanup the Vary header and keep the user context hash if we are in debug mode
Cache Tagging
- Fixed: Clear the ResponseTagger after we tagged a response. Usually PHP uses a new instance for every request. But for example the hash lookup when using Symfony HttpCache does two requests in the same PHP process.
-
2.5.127 Sep 2018Release notes
Open source →Cache Tagging
- Fixed:
MaxHeaderValueLengthFormatter::getTagsHeaderNamenow actually returns the value.
- Fixed:
-
2.5.010 Sep 2018Release notes
Open source →Cache Tagging
- Added:
MaxHeaderValueLengthFormatterto allow splitting cache tag headers into multiple headers.
Symfony HttpCache
- Have cache invalidator check for presence of Psr6Store for a better guess whether the cache really is TagCapable or not.
- Added:
-
2.4.030 Jul 2018Release notes
Open source →Symfony HttpCache
- Added:
CleanupCacheTagsListenerto remove the cache tags header from the final response that is sent to the client. Add this listener to your cache kernel.
Cache Tagging
- Improved: The
ResponseTaggerdoes now remove duplicate tags.
- Added:
-
2.3.106 Jul 2018Release notes
Open source →Varnish
- Fixed: Do not
preg_quotetags when using xkey. Quoting is only used for BAN requests that expect a regular expression. This bug only affected you if you use xkey and used characters in your tags that are changed bypreg_quote.
- Fixed: Do not
-
2.3.024 Apr 2018Release notes
Open source →ProxyClient
- The
HttpProxyClientnow accepts an instance of the newDispatcherinterface instead of the concreteHttpDispatcher, allowing for more flexibility.
Symfony
- Introduced a new
KernelDispatcherfor the Symfony proxy that calls the application kernel directly instead of executing a full HTTP request.
- The
-
2.2.127 Mar 2018Release notes
Open source →Varnish
- The provided VCL for custom TTL no longer provides
import std;because each import may only exist once.
- The provided VCL for custom TTL no longer provides
-
2.2.023 Mar 2018Release notes
Open source →Varnish
- Added support for the more efficient xkey cache tag system. BAN remains the default cache tagging system, but if you can install the varnish modules in your system, it is recommended to update to xkey.
- No inline C is needed for the custom TTL header with Varnish 4 or better. use
std.duration()instead.
Symfony user context
- You can now also specify which headers are used for
authentication to detect anonymous requests. By default, the headers are the
previously hardcoded
Authorization,HTTP_AUTHORIZATIONandPHP_AUTH_USER.
-
2.1.315 Mar 2018Release notes
Open source →Symfony HttpCache
- Fixed bug in Symfony tag invalidation. Do not check if host is missing in request creation.
-
2.1.207 Feb 2018Release notes
Open source →Symfony HttpCache
- Fixed issue with detection if toflar psr6 store is available.
-
2.1.101 Feb 2018Release notes
Open source →Varnish
-
Updated X-Cache-Tags regex to prevent matching partial tags
Invalidating objects with a tag of 'bar' would have previously also have invalidated objects with a tag that ends in 'bar', eg. 'foobar'. Now when invalidating an object the tag name must match in full.
-
-
2.1.019 Dec 2017Release notes
Open source →- Support Symfony 4.
Testing
- Upgraded phpunit to 5.7 / 6. If you use anything from the
FOS\HttpCache\Testnamespace you need to update your project to use PHPUnit 6 (or 5.7, if you are using PHP 5.6).
Symfony HttpCache
-
Cache tagging support for Symfony HttpCache
Added a
PurgeTagsListenerfor tag based invalidation with the SymfonyHttpCachereverse caching proxy. This requires the newly created Toflar Psr6Store built on PSR-6 cache and supporting pruning expired cache entries. -
Using Request::isMethodCacheable rather than Request::isMethodSafe to correctly handle OPTIONS and TRACE requests.
-
2.0.218 Aug 2017 -
2.0.123 Jun 2017 -
2.0.024 May 2017Release notes
Open source →PHP
- Raised minimum PHP version to 5.6.
- BC break: Removed the
Interfacesuffix from all interfaces. - BC break: Renamed
HashGeneratortoDefaultHashGenerator. - Added
HashGeneratorinterface.
HTTP
- BC break: Replaced hard coupling on Guzzle HTTP client with HTTPlug. You now need to explicitly specify a supported HTTP adapter in composer.json; see installation instructions.
- BC break: Separated the HttpDispatcher from the proxy clients. All existing clients still use HTTP to send invalidation requests.
- Added support and documentation for setting a custom TTL specifically for the caching proxy.
Logging
- BC break: Renamed the log event listener from
LogSubscribertoLogListener.
Proxy clients
- BC break: Renamed the
Ban,Purge,RefreshandTaginterfaces toBanCapable,PurgeCapable,RefreshCapableandTagCapable.
Tagging
- BC break: Moved tag invalidation to
CacheInvalidator, and renamedTagHandlertoResponseTagger. - Abstracting tags by adding new
TagCapablefor ProxyClients. - Added
strictoption toResponseTaggerthat throws an exception when empty tags are added. By default, empty tags are ignored. - Added
TagHeaderFormatterinterface that is used within theResponseTaggerto provide the header name and for formatting the tags header value.
Varnish
- Varnish configuration are now files that you can directly include from your .vcl and call custom functions to avoid copy-pasting VCL code.
- Added support for and changed default to Varnish version 5.
- Moved Varnish 4 and 5 configuration files from
resources/config/varnish-4/toresources/config/varnish/. - Changed default Varnish version to 5.
- Removed special case for anonymous users in user context behaviour. Varnish now does a hash lookup for anonymous users as well.
NGINX
- The NGINX purge location is no longer passed as constructor argument but by
calling
setPurgeLocation().
Symfony HttpCache
- BC break: Renamed all event listeners to
XxListenerinstead ofXxSubscriber. - BC break: Constructors for
PurgeListenerandRefreshListenernow use an options array for customization. - BC break: Converted abstract event dispatching kernel class
EventDispatchingHttpCacheto a trait, which now provides theaddSubscriberandaddListenermethods. In yourAppCache, replaceAppCache extends EventDispatchingHttpInterfacewith ause EventDispatchingHttpCache;statement. - The user context by default does not use a hardcoded hash for anonymous users but does a hash lookup. You can still configure a hardcoded hash.
Testing
- BC break: Refactored the proxy client test system into traits. Removed
ProxyTestCase; use the traitsCacheAssertionsandHttpCallerinstead. - Added HTTP method parameter to
HttpCaller::getResponse().
-
2.0.0-beta3no date pre-releaseRelease notes
Open source →- BC break: The
ResponseTaggerno longer expects an instance ofTagCapableas first argument. To adjust the tag header name or the way the tags are formatted, use the newheader_formatteroption with aTagHeaderFormatter.
- BC break: The
-
2.0.0-beta212 Mar 2017 pre-releaseNothing published for this version
-
2.0.0-beta103 Feb 2017 pre-releaseNothing published for this version
-
2.0.0-alpha115 Nov 2016 pre-releaseNothing published for this version
-
1.4.616 Jul 2020Release notes
Open source →- [Symfony HttpCache] Added a neutral "Bad Request" body to user hash mismatch response to have something searchable in the code when debugging.
-
1.4.517 Mar 2018Release notes
Open source →- Symfony user context: You can now also specify which headers are used for
authentication to detect anonymous requests. By default, the headers are the
previously hardcoded
Authorization,HTTP_AUTHORIZATIONandPHP_AUTH_USER.
- Symfony user context: You can now also specify which headers are used for
authentication to detect anonymous requests. By default, the headers are the
previously hardcoded
-
1.4.409 Oct 2017 -
1.4.318 Aug 2017 -
1.4.202 Feb 2016Release notes
Open source →- The TagHandler constructor now accepts a
headerLengthargument which will cause itsinvalidateTagsfunction to invalidate in batches if the header length exceeds this value.
- The TagHandler constructor now accepts a
-
1.4.107 Dec 2015 -
1.4.002 Jun 2015Release notes
Open source →- Added symfony/http-kernel HttpCache client.
- Added SymfonyTestCase.
- Removed unneeded files from dist packages.
-
1.3.208 May 2015 -
1.3.101 Apr 2015Release notes
Open source →- Added authentication support to user context subscribe.
- Fixed usage of deprecated Guzzle subtree splits.
- Fixed exposed cache tags.
-
1.3.013 Feb 2015Release notes
Open source →- Added TagHandler.
- It is no longer possible to change the event dispatcher of the CacheInvalidator once its instantiated. If you need a custom dispatcher, set it right after creating the invalidator instance.
- Deprecated
CacheInvalidator::addSubscriberin favor of either using the event dispatcher instance you inject or doinggetEventDispatcher()->addSubscriber($subscriber).
-
1.2.017 Jan 2015Release notes
Open source →- Added support for the symfony/http-kernel component reverse proxy HttpCache.
-
1.1.221 Nov 2014Release notes
Open source →- Fixed documentation for user context varnish configuration to also work when
client omits the
AcceptHTTP header.
- Fixed documentation for user context varnish configuration to also work when
client omits the