PHPackages                             webignition/simplytestable-pagecache-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. webignition/simplytestable-pagecache-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

webignition/simplytestable-pagecache-bundle
===========================================

Symfony 4 bundle for creating/validating cacheable responses

0.2(7y ago)0120PHPPHP &gt;=7.2.0

Since Aug 27Pushed 7y ago1 watchersCompare

[ Source](https://github.com/webignition/simplytestable-pagecache-bundle)[ Packagist](https://packagist.org/packages/webignition/simplytestable-pagecache-bundle)[ Docs](https://github.com/webignition/simplytestable-pagecache-bundle)[ RSS](/packages/webignition-simplytestable-pagecache-bundle/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (2)Dependencies (10)Versions (3)Used By (0)

Symfony 4 bundle for creating/validating cacheable responses
============================================================

[](#symfony-4-bundle-for-creatingvalidating-cacheable-responses)

Introduction
------------

[](#introduction)

Easily make cacheable `Response` objects to be returned from your controllers for content that:

- can change
- doesn't always change on every single request
- can be cached for an unknown amount of time

A created cacheable response has the following headers set:

- `Cache-Control: must-revalidate, public`
- `Last-Modified: `
- `Etag: `

Subsequent requests made by a browser will include a `If-None-Match: ` header which we can then use to determine if we should tell the browser to re-use the previously-cached response.

Installation
------------

[](#installation)

### Install via composer:

[](#install-via-composer)

Use composer to add as a project dependency:

```
composer require simplytestable-pagecache-bundle:^0.1

```

### Update your database schema:

[](#update-your-database-schema)

Details of cache-related headers previously sent are persisted to an object store. This bundle provides an entity, you need to update your database schema to allowt the entities to be persisted.

```
./bin/console doctrine:migrations:diff
./bin/console doctrine:migrations:migrate

```

Usage
-----

[](#usage)

This bundle provides a `SimplyTestable\PageCacheBundle\Services\CacheableResponseFactory` service. Use this as a type-hint in a controller constructor or in a controller action.

### Minimal usage

[](#minimal-usage)

```
