Download the PHP package nocs/laravel-retriever without Composer
On this page you can find all versions of the php package nocs/laravel-retriever. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nocs/laravel-retriever
More information about nocs/laravel-retriever
Files in nocs/laravel-retriever
Package laravel-retriever
Short Description Retrieve cached data made simple.
License MIT
Homepage https://github.com/nineoclocksomewhere/laravel-retriever
Informations about the package laravel-retriever
laravel-retriever
Retrieve cached data made simple
Installation
Install with composer
Usage
Place your cache files under app/Retrievers (primary) or app/Cache (secondary).
Use the App\Retrievers or App\Cache namespace for your classes.
Use, as usual, studlied strings for your classnames. When retrieving use a snaked version in your key.
Define public non-static methods which return the cached values.
Basic usage
Example: app/Cache/Colors.php
Retrieve the value with:
Using one method
When using only one method, you can use the get method. app/Cache/Colors.php
And retrieve the value with:
Using namespaces
When creating vendors you can use namespaces.
Give your cache files the correct namespace, for example MyVendor\Cache.
Place your cache class files in location src/Retrievers or src/Cache.
Add the location in your ServiceProvider class in the boot section.
Retrieve the value with the namespace prefixed (snaked) to the key:
Arguments
A second argument to the get call can be provided as an array of arguments that will be passed to the cache closure.
Short
Instead of using
you can use
Testing
To test, run
Security
If you discover any security related issues, please email the author instead of using the issue tracker.
Credits
- Nine O'Clock Somewhere
- All Contributors
License
MIT. Please see the license file for more information.