madewithlove / illuminate-psr-cache-bridge
Installs: 1 393 019
Dependents: 13
Suggesters: 3
Security: 0
Stars: 87
Watchers: 15
Forks: 9
Open Issues: 1
Requires
- php: >=5.6.0
- illuminate/contracts: ^5.0
- psr/cache: ^1.0
Requires (Dev)
- cache/integration-tests: ^0.16.0
- illuminate/cache: ^5.0
- nesbot/carbon: ^1.3.0
- phpunit/phpunit: ^4.8
Provides
- psr/cache-implementation: 1.0.0
This package is auto-updated.
Last update: 2024-11-29 04:46:47 UTC
README
This package adds PSR-6 cache support to Laravel 5. Laravel 6 has PSR-6 support build in which can be used through the cache.psr6
container alias.
Usage
To start using a Psr\Cache\CacheItemPoolInterface
typed implementation that stores data in Laravel's configured cache, add this to a service provider:
use Illuminate\Contracts\Cache\Repository; use Madewithlove\IlluminatePsrCacheBridge\Laravel\CacheItemPool; use Psr\Cache\CacheItemPoolInterface; $this->app->singleton(CacheItemPoolInterface::class, function ($app) { $repository = $app->make(Repository::class); return new CacheItemPool($repository); });
Right now you're all set to start injecting CacheItemPoolInterface
'd everywhere you need it.
Install
In order to install it via composer you should run this command:
composer require madewithlove/illuminate-psr-cache-bridge
Testing
vendor/bin/phpunit
# or:
vendor/bin/phpunit --testsuite=integration-tests
vendor/bin/phpunit --testsuite=unit-tests
Credits
License
The MIT License (MIT). Please see License File for more information.