Package Data | |
---|---|
Maintainer Username: | willrowe |
Maintainer Contact: | wrowe@will-rowe.com (Will Rowe) |
Package Create Date: | 2014-10-06 |
Package Last Update: | 2015-02-05 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-03-26 03:13:41 |
Package Statistics | |
---|---|
Total Downloads: | 159 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 6 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
Response Cache for Laravel provides an easy way for route responses to be cached, handling the storage and retrieval of the response as well as the necessary headers to utilize client-side browser caching.
Installation
Configuration
Usage
Release Notes
Version Compatibility
License
Add the package to your project's composer.json
file.
Command Line:
composer require wowe/laravel-response-cache:1.0.*
Edit Manually:
"require": {
"wowe/laravel-response-cache": "1.0.*"
}
Update Composer.
composer update
Add the service provider to your app.php
config file.
'Wowe\Cache\Response\ServiceProvider'
The configuration file may be published to the config
directory by using the command:
php artisan config:publish wowe/laravel-response-cache
This is recommended since the configuration file that comes with the installation can be overridden by an update.
Available Settings
enabled
(boolean)
life
(integer)
global
(boolean)
###Simple Setup###
For a simple site you may cache all responses generated by routes using the GET
method by setting the global
config setting to true
. To adjust how long these responses will be cached just change the value of the life
config setting.
###Advanced Setup### For projects where you need more control over which route responses are cached you may use the available route actions:
cache
'cache'
is set on the action as a string then it is equivalent to 'cache' => true
and will cache the route's response.'cache' => true
is set on the action then the route's response will be cached.'cache' => false
is set on the action then the route's response will not be cached.'cache' => 90
), then the route's response will be cached for that many minutes.no-cache
'cache' => false
and should be set as a string on the action. It cannot accept any value and should not appear in the action as a key.
These actions may be applied to either an individual route or a route group.
###Examples:###
// No value
Route::get('foo', ['FooController@getFoo', 'cache']);
// True
Route::get('bar', ['FooController@getBar', 'cache' => true]);
// Integer, will cache for 90 minutes
Route::get('baz', ['FooController@getBaz', 'cache' => 90]);
// Group
Route::group(['cache'], function () {
Route::get('qux', 'FooController@getQux');
});
// No value
Route::get('foo', ['FooController@getFoo', 'no-cache']);
// False
Route::get('bar', ['FooController@getBar', 'cache' => false]);
// Group
Route::group(['no-cache'], function () {
Route::get('qux', 'FooController@getQux');
});
Additional information can be found in the CHANGELOG.md file
Laravel | Response Cache --------|--------------- 4.2.x | 1.0.x
The Route Response for Laravel package is open-sourced software licensed under the MIT license