Download the PHP package shawnley/laravel-httpcache without Composer
On this page you can find all versions of the php package shawnley/laravel-httpcache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-httpcache
HttpCache for Laravel 5
For Laravel 4.1+, require v0.1.x
Laravel 5 can use HttpKernelInterface Middlewares, so also HttpCache. This package provides a simple ServiceProvider to get you started with HttpCache.
First, require this package in composer.json and run composer update
"barryvdh/laravel-httpcache": "0.2.x@dev"
After updating, add the ServiceProvider to the array of providers in app/config/app.php
'Barryvdh\HttpCache\ServiceProvider',
You can now add the Middleware to your Kernel:
'Barryvdh\HttpCache\Middleware\CacheRequests',
Caching is now enabled, for public responses. Just set the Ttl or MaxSharedAge
You can also define a filter.
Publish the config to change some options (cache dir, default ttl, etc) or enable ESI.
$ php artisan vendor:publish --provider="Barryvdh\HttpCache\ServiceProvider"
ESI
Enable ESI in your config file and add the Esi Middleware to your Kernel:
'Barryvdh\HttpCache\Middleware\ParseEsi',
You can now define ESI includes in your layouts.
<esi:include src="<?= url('partial/page') ?>"/>
This will render partial/page, with it's own TTL. The rest of the page will remain cached (using it's own TTL)
Purging/flushing the cache
You can purge a single url or just delete the entire cache directory:
Or use the Artisan httpcache:clear
command
$ php artisan httpcache:clear
More information
For more information, read the Docs on Symfony HttpCache
All versions of laravel-httpcache with dependencies
illuminate/support Version 5.0.x|5.1.x
symfony/console Version ~2.6
symfony/http-kernel Version ~2.6
barryvdh/laravel-stack-middleware Version 0.2.*