PHPackages                             switon/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. switon/context

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

switon/context
==============

Runtime context isolation with scoped state for Switon Framework

v1.0.0(1mo ago)031MITPHPPHP &gt;=8.3CI passing

Since May 9Pushed 1mo agoCompare

[ Source](https://github.com/switon-php/context)[ Packagist](https://packagist.org/packages/switon/context)[ Docs](https://github.com/switon-php/context)[ RSS](/packages/switon-context/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (2)Used By (1)

Switon Context Package
======================

[](#switon-context-package)

Runtime context isolation and scoped state for Switon Framework.

Installation
------------

[](#installation)

```
composer require switon/context
```

**Requirements:** PHP 8.3+

Quick Start
-----------

[](#quick-start)

```
use Switon\Core\Attribute\Autowired;
use Switon\Core\ContextAware;
use Switon\Core\ContextManagerInterface;

class ExampleViewContext
{
    public array $vars = [];
}

class ExampleView implements ContextAware
{
    #[Autowired] protected ContextManagerInterface $contextManager;

    public function getContext(): ExampleViewContext
    {
        return $this->contextManager->getContext($this);
    }

    public function setVar(string $name, mixed $value): void
    {
        $this->getContext()->vars[$name] = $value;
    }
}
```

Docs:

License
-------

[](#license)

MIT.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance94

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

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

31d ago

### Community

Maintainers

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

---

Top Contributors

[![switon-php](https://avatars.githubusercontent.com/u/247358032?v=4)](https://github.com/switon-php "switon-php (6 commits)")

---

Tags

contextruntimescopeswitonContextruntimescopeswiton

### Embed Badge

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

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

###  Alternatives

[phpro/soap-client

A general purpose SoapClient library

8955.9M52](/packages/phpro-soap-client)[symfony/runtime

Enables decoupling PHP applications from global state

74694.9M933](/packages/symfony-runtime)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

317117.1k1](/packages/cognesy-instructor-php)[phplang/scope-exit

Emulation of SCOPE\_EXIT construct from C++

1913.0M4](/packages/phplang-scope-exit)[johndoh/contextmenu

Adds context menus with common tasks to various parts of Roundcube

9778.4k1](/packages/johndoh-contextmenu)[kartik-v/yii2-nav-x

An extended bootstrap Nav widget for Yii 2 with submenu drilldown.

27579.9k6](/packages/kartik-v-yii2-nav-x)

PHPackages © 2026

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