PHP single context. Key value store in current context.
arifmahmudrana/context is a Laravel package for php single context. key value store in current context..
It currently has 4 GitHub stars and 24 downloads on Packagist (latest version v1.0.0).
Install it with composer require arifmahmudrana/context.
Discover more Laravel packages by arifmahmudrana
or browse all Laravel packages to compare alternatives.
Last updated
This is nothing but a key value store in the current context. You store value & in other places you retrieve value by it's key.
composer require arifmahmudrana/context
and that's it.
use ArifMahmudRana\Context\ContextContainer;
ContextContainer::set('user', User::find(1))//Save user Returns true
use ArifMahmudRana\Context\ContextContainer;
ContextContainer::get('user')//Get user
use ArifMahmudRana\Context\ContextContainer;
ContextContainer::has('user')//Return true
use ArifMahmudRana\Context\ContextContainer;
ContextContainer::all()//Returns key value ['user' => User Object] default empty array
use ArifMahmudRana\Context\ContextContainer;
ContextContainer::remove('user')//Returns true removes the key
CannotInstantiateClassExceptions exception\InvalidArgumentException exceptionTo Run the tests
./vendor/bin/phpunit //run phpunit
All contributions are welcome, for any bug, issue or merge request please refer to CONTRIBUTING.md
Released under the MIT License, see LICENSE.