PHPackages                             arifmahmudrana/context - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. arifmahmudrana/context

ActiveLibrary[Framework](/categories/framework)

arifmahmudrana/context
======================

PHP single context. Key value store in current context.

v1.0.0(9y ago)424MITPHPPHP &gt;=5.4

Since Feb 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/arifmahmudrana/context)[ Packagist](https://packagist.org/packages/arifmahmudrana/context)[ Docs](https://github.com/arifmahmudrana/context)[ RSS](/packages/arifmahmudrana-context/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (1)Used By (0)

PHP Context(Key Value Data Store)
=================================

[](#php-contextkey-value-data-store)

[![Build Status](https://camo.githubusercontent.com/dae7242a23a43aedd629116406fae23a17b421cedbf469b070160c18931cfc3d/68747470733a2f2f7472617669732d63692e6f72672f617269666d61686d756472616e612f636f6e746578742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/arifmahmudrana/context)

This is nothing but a key value store in the current context. You store value &amp; in other places you retrieve value by it's key.

Usage
-----

[](#usage)

### Step 1: Install Through Composer

[](#step-1-install-through-composer)

```
composer require arifmahmudrana/context

```

and that's it.

Examples
--------

[](#examples)

- [Set Value](#set-value)
- [Get Value](#get-value)
- [Has Value](#has-value)
- [All Value](#all-value)
- [Remove Value](#remove-value)

### Set Value

[](#set-value)

```
use ArifMahmudRana\Context\ContextContainer;

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

```

### Get Value

[](#get-value)

```
use ArifMahmudRana\Context\ContextContainer;

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

```

### Has Value

[](#has-value)

```
use ArifMahmudRana\Context\ContextContainer;

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

```

### All Value

[](#all-value)

```
use ArifMahmudRana\Context\ContextContainer;

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

```

### Remove Value

[](#remove-value)

```
use ArifMahmudRana\Context\ContextContainer;

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

```

Important
---------

[](#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
-----

[](#tests)

To Run the tests

```
./vendor/bin/phpunit //run phpunit

```

Contributing
------------

[](#contributing)

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

License
-------

[](#license)

Released under the MIT License, see LICENSE.

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3331d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5e935151cceb2f26cddc4aef7e413da597e32694dfcde3f7a20208d15ee1793?d=identicon)[arifmahmudrana](/maintainers/arifmahmudrana)

---

Top Contributors

[![arifmahmudrana](https://avatars.githubusercontent.com/u/2046796?v=4)](https://github.com/arifmahmudrana "arifmahmudrana (2 commits)")

---

Tags

contextkey-valuephpstoresymfonyframeworklaravel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/arifmahmudrana-context/health.svg)

```
[![Health](https://phpackages.com/badges/arifmahmudrana-context/health.svg)](https://phpackages.com/packages/arifmahmudrana-context)
```

###  Alternatives

[dragon-code/support

Support package is a collection of helpers and tools for any project.

238.2M74](/packages/dragon-code-support)[hemp/presenter

Easy Model Presenters in Laravel

247582.7k1](/packages/hemp-presenter)[rahulalam31/laravel-abuse-ip

Block ip address of all spammer's around the world.

27330.5k](/packages/rahulalam31-laravel-abuse-ip)[phphleb/webrotor

Asynchronous PHP web server for shared hosting

631.5k1](/packages/phphleb-webrotor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
