New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

arifmahmudrana/context

PHP single context. Key value store in current context.
24 4
Install
composer require arifmahmudrana/context
Latest Version:v1.0.0
PHP:>=5.4
License:MIT
Last Updated:May 13, 2017
Links: GitHub  ·  Packagist
Maintainer: arifmahmudrana

PHP Context(Key Value Data Store)

Build Status

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.

Usage

Step 1: Install Through Composer

composer require arifmahmudrana/context

and that's it.

Examples

Set Value

use ArifMahmudRana\Context\ContextContainer;

ContextContainer::set('user', User::find(1))//Save user Returns true

Get Value

use ArifMahmudRana\Context\ContextContainer;

ContextContainer::get('user')//Get user

Has Value

use ArifMahmudRana\Context\ContextContainer;

ContextContainer::has('user')//Return true

All Value

use ArifMahmudRana\Context\ContextContainer;

ContextContainer::all()//Returns key value ['user' => User Object] default empty array

Remove Value

use ArifMahmudRana\Context\ContextContainer;

ContextContainer::remove('user')//Returns true removes the key

Important

  1. You can't instantiate this class if tried it will throw CannotInstantiateClassExceptions exception
  2. You can use only string as key else it will throw \InvalidArgumentException exception

Tests

To Run the tests

./vendor/bin/phpunit //run phpunit

Contributing

All contributions are welcome, for any bug, issue or merge request please refer to CONTRIBUTING.md

License

Released under the MIT License, see LICENSE.

Related Packages

vilnius-technology/symfonys-facade

Symfonys facade for The Laravel Framework.

75 1
brainfab/laravel-form

Use Symfony Form component with Laravel framework

13 1
simovative/zeus

A Post-Redirect-Get specialised framework for PHP

119,961 7
ppi/skeleton-app

The PPI Skeleton Application - A pre-built application around the PPI Framework....

91 53

Version History

Version Released PHP License
v1.0.0 >=5.4 MIT