2017 © Pedro Peláez
 

library php-valid

A HTTP cache validation toolkit

image

knplabs/php-valid

A HTTP cache validation toolkit

  • Tuesday, September 19, 2017
  • by Knplabs
  • Repository
  • 29 Watchers
  • 4 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 5 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

php-valid

What

A php 5.3+ library to help manage HTTP/1.1 cache validation headers, using the symfony/HttpFoundation layer., (*1)

Why

Because there is no known library that provides a clean, decoupled way to manage them. The actual docs just shows dirty controller examples., (*2)

How

By observing requests and asking Rule instances if response has changed since last time client asked, either using If-Modified-Since or ETag headers., (*3)

Install

``` shell, (*4)

composer require "knplabs/valid=~0.1@dev", (*5)


## Use ``` php <?php class CustomRule implements Knp\Valid\Rule\LastModified, Knp\Valid\Rule\ETag { public function supports(Request $request) { return true; } public function getETag(Request $request) { return 'something'; } public function getLastModified(Request $request) { return new \DateTime; } } $kernel = new AppCache( new Knp\Valid\Kernel( new AppKernel('prod', false), new Knp\Valid\ResponseManipulator(array( new Knp\Valid\Doctrine\ListenerRule, new CustomRule, )) ) ); $kernel->handle(Request::createFromGlobals())->send();

Contribute

``` shell, (*6)

composer install --dev --prefer-dist, (*7)

vim features/**/*.feature behat phpspec desc Knp\Valid* phpspec run, (*8)

```, (*9)

The Versions

19/09 2017

dev-add-unmaintained

dev-add-unmaintained

A HTTP cache validation toolkit

  Sources   Download

MIT

The Requires

 

The Development Requires

by Florian Klein