PHPackages                             switon/core - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. switon/core

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

switon/core
===========

Shared framework contracts, attributes, helpers, and runtime vocabulary for Switon Framework

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

Since Jun 6Pushed 1mo agoCompare

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

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

Switon Core Package
===================

[](#switon-core-package)

[![CI](https://camo.githubusercontent.com/31325f8b81af464d348ca43a326663bd7f21379af9247b0bfc0ae632e42ddf75/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f737769746f6e2d7068702f636f72652f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4349)](https://github.com/switon-php/core/actions/workflows/ci.yml) [![PHP 8.3+](https://camo.githubusercontent.com/c03f51341eebaefabbf137e291b20523fc74b4ffd084406d88524d266d95085d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d373737424234)](https://www.php.net/)

Switon's shared foundation for autowiring, app metadata, runtime state, context-aware components, and JSON helpers.

Highlights
----------

[](#highlights)

- **Property autowiring:** `#[Autowired]` injects services, scalars, and arrays from the container.
- **App and runtime state:** app identity, environment, debug mode, timezone, and project-root detection stay explicit.
- **Scoped state support:** `ContextAware`, `ContextIsolated`, and related helpers keep mutable state controlled.
- **Common helpers:** JSON, strings, random, clock, and path helpers are included.
- **Shared contracts:** the package exposes the base interfaces other components build on.

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

[](#installation)

```
composer require switon/core
```

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

[](#quick-start)

```
use Switon\Core\AppInterface;
use Switon\Core\Attribute\Autowired;
use Switon\Core\Json;

class StatusReporter
{
    #[Autowired] protected AppInterface $app;

    public function snapshot(): string
    {
        return Json::stringify([
            'app' => $this->app->name(),
            'env' => $this->app->env(),
            'debug' => $this->app->isDebug(),
        ], JSON_PRETTY_PRINT);
    }
}
```

Docs:

License
-------

[](#license)

MIT.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance90

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community19

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

48d 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 (1 commits)")

---

Tags

attributecontractscoreswitonutilitiescontractscoreattributesutilitiesswiton

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[symfony/contracts

A set of abstractions extracted out of the Symfony components

3.9k65.9M138](/packages/symfony-contracts)[cakephp/core

CakePHP Framework Core classes

6128.7M64](/packages/cakephp-core)[api-platform/state

API Platform state interfaces

294.9M137](/packages/api-platform-state)[metamodels/core

MetaModels core

10156.4k68](/packages/metamodels-core)[infocyph/intermix

A lightweight PHP DI container, invoker, serializer, and utility toolkit.

137.7k3](/packages/infocyph-intermix)[cspray/annotated-container

Create Dependency Injection containers configured with PHP8 Attributes.

421.3k5](/packages/cspray-annotated-container)

PHPackages © 2026

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