Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
114 lines (80 sloc) 4.05 KB

Overview

Installation

This bundle is available on Packagist. You can install it using Composer. Note that the FOSHttpCache_ library needs a psr/http-message-implementation and php-http/client-implementation. If your project does not contain one, composer will complain that it did not find psr/http-message-implementation.

To install the bundle together with Guzzle, run:

$ composer require friendsofsymfony/http-cache-bundle guzzlehttp/psr7 php-http/guzzle6-adapter

If you want to use something else than Guzzle 6, see Packagist for a list of available client implementations.

Then add the bundle to your application:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new FOS\HttpCacheBundle\FOSHttpCacheBundle(),
        // ...
    );
}

For most features, you also need to :ref:`configure a caching proxy <foshttpcache:proxy-configuration>`.

Requirements

SensioFrameworkExtraBundle

If you want to use this bundle’s annotations, install the SensioFrameworkExtraBundle:

$ composer require sensio/framework-extra-bundle

And include it in your project:

 <?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new FOS\HttpCacheBundle\FOSHttpCacheBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        // ...
    );

ExpressionLanguage

If you wish to use expressions_ in your annotations , you also need Symfony’s ExpressionLanguage component. If you’re not using full-stack Symfony 2.4 or later, you need to explicitly add the component:

$ composer require symfony/expression-language

Configuration

Now you can configure the bundle under the fos_http_cache key. The :doc:`features` section introduces the bundle’s features. The :doc:`reference/configuration` section lists all configuration options.

Functionality

This table shows where you can find specific functions.

Functionality Annotations Configuration Manually
Set Cache-Control headers (SensioFrameworkExtraBundle) :doc:`rules <reference/configuration/headers>` (Symfony)
Tag and invalidate :doc:`@Tag </features/tagging>` :doc:`rules <reference/configuration/headers>` :doc:`cache manager <reference/cache-manager>`
Invalidate routes :ref:`invalidateroute` :ref:`invalidators <invalidation configuration>` :doc:`cache manager <reference/cache-manager>`
Invalidate paths :ref:`invalidatepath` :ref:`invalidators <invalidation configuration>` :doc:`cache manager <reference/cache-manager>`

License

This bundle is released under the MIT license.

.. literalinclude:: ../../src/Resources/meta/LICENSE
    :language: none

You can’t perform that action at this time.