andreizakharkin / custom-static-caching
Custom static caching
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/andreizakharkin/custom-static-caching
Requires
- php: >=5.6.0
- laravel/framework: ~5.2
This package is not auto-updated.
Last update: 2025-12-21 11:04:13 UTC
README
Custom static cache
Laravel compatibility
Laravel 5 is released!!
| Laravel | custom-static-caching |
|---|---|
| 5.2.x | dev-master |
Installation
Composer
Download via composer.
composer require andreizakharkin/custom-static-caching:dev-master
Laravel
Register the service provider with your application.
Open config/app.php and find the providers key. Add CustomStaticCacheServiceProvider to the array.
... Zakharkin\CustomStaticCache\CustomStaticCacheServiceProvider::class, ...
Publish vendor config
php artisan vendor:publish --provider="Zakharkin\CustomStaticCache\CustomStaticCacheServiceProvider" --tag="config"
Usage
There are two main functions that helps you to use static caching.
checkAndShow() - function that can check and render the cache file
save() - function that saves a cache file
You can use this functions in anywhere places of your application. The only rule is need to be followed is that the checkAndShow() function must be triggered, after the autoload is completed
Example usage in public/index.php
... require __DIR__.'/../bootstrap/autoload.php'; \Zakharkin\CustomStaticCache\CustomStaticCache::getInstance()->checkAndShow(); ... $kernel->terminate($request, $response); \Zakharkin\CustomStaticCache\CustomStaticCache::getInstance()->save();