ipunkt/laravel-route-cache
Larablocks Analysis
ipunkt/laravel-route-cache works with Laravel 4 (latest release 1.0.3, Jul 28, 2014), which reached end of life: no more fixes, even for security.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- Supports only Laravel 4, past end of life
- No release in the last 12 months (last: Jul 28, 2014)
- 0 downloads a month (needs 10,000)
- 5 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Jul 28, 2014.
- No releases in the last 12 months.
- First released: Jul 25, 2014.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 30, 2026.
| Install | |
|---|---|
composer require ipunkt/laravel-route-cache |
|
| Latest Version: | 1.0.3 |
| PHP: | >=5.4.0 |
| Laravel: | 4 |
| License: | MIT |
| Last Updated: | Jul 28, 2014 |
| Links: | GitHub · Packagist |
Route Cache for Laravel 4.x
This package simplifies caching of static pages in your laravel project. It sends 304 status headers and (if available) static html without running the controller. The configuration ist easy and straight forward using a single route-filter.
Installation
Add to your composer.json following lines
"require": {
"ipunkt/laravel-route-cache": "~1.0.0"
}
Run php artisan config:publish ipunkt/laravel-route-cache
Add 'Ipunkt\LaravelRouteCache\LaravelRouteCacheServiceProvider', to providers in app/config/app.php.
Configuration
Edit config.php in app/config/packages/ipunkt/laravel-route-cache to your needs.
How to use as Laravel Route-Filter
Add 'before' => 'cache.before' to every route you like to cache. The route has to be canonical!, because the filter caches just by extracting the url() from the Request. (maybe i change that to fullUrl())
To outdate a cache, just fire the Event entity.modified and attach the Request or URL of the modified ressource. You can force that on your browser by attaching the GET-Parameter set in your config as cachebuster (default is "renew-cache") to the URL.
If the infoheader config setting is not false the library adds a Header to the Response to show wether the content came from cache or the controller.
Other usages
The class Ipunkt\LaravelRouteCache\RouteCache works out of the box without the filter. You can use it in your controllers
// get RouteCache-Instance
$routecache = \App::make('routecache');
$routecache->setEntityFromRequest($request);
// or
$routecache->setEntityFromUrl($url);
// to remove the cache
$routecache->removeCache()
// to check if the client has a valid (same ETag) Cache
$routecache->checkClientHasValidCache()
// to save a Response to the Cache
$routecache->setCacheFromResponse(Response $response)
// to save string-content to the Cache
$routecache->setCacheFromContent($content)
// to get a saved Response from the Cache
$routecache->getResponseFromCache()
// to get a saved string from the Cache
$routecache->getContentFromCache()
// you can get the ETag for the entity (but you don't need it)
$routecache->getETag()
// you can even set a custom ETag if you like
$routecache->getETag($value)
Open TODOs
Feel free to fork and push changes
- remember all cached entities and allow to clear them with a Command
- add TestCases
- cache content-type of the content and respond with that.
- Routines to handle POST, PUT, UPDATE and DELETE Requests
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.0.3 | >=5.4.0 | 4.* | MIT | |
| 1.0.2 | >=5.4.0 | 4.* | MIT | |
| 1.0.1 | >=5.4.0 | 4.* | MIT | |
| 1.0.0 | >=5.4.0 | 4.* | MIT |