Getting started


The FOSHttpCache library is available on Packagist. You can install the library and its dependencies using Composer:

$ composer require friendsofsymfony/http-cache

The library relies on HTTPlug for asynchronously sending invalidation requests over HTTP. There is no PSR for asynchronous HTTP client, you need to install an HTTPlug-compatible client or adapter:

$ composer require php-http/guzzle7-adapter

Then install the FOSHttpCache library itself:

$ composer require friendsofsymfony/http-cache


This library follows Semantic Versioning. Except for major versions, we aim to not introduce BC breaks in new releases.


There are three things you need to do to get started:

  1. configure your proxy server

  2. set up a client for your proxy server

  3. set up the cache invalidator


This library mainly consists of:

  • low-level clients for communicating with a proxy server (Varnish, NGINX and Symfony HttpCache)

  • a cache invalidator that acts as an abstraction layer for the proxy client

  • test classes that you can use for integration testing your application against a proxy server.

Measures have been taken to minimize the performance impact of sending invalidation requests:

  • Requests are not sent immediately, but aggregated to be sent in parallel.

  • You can determine when the requests should be sent. For optimal performance, do so after the response has been sent to the client.