PHPackages                             psg/sr4 - 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. psg/sr4

ActiveLibrary

psg/sr4
=======

Flexible Layered DI App Standard

0.1(4y ago)04MITPHPPHP &gt;=7.2.0

Since Jul 31Pushed 4y ago1 watchersCompare

[ Source](https://github.com/PHP-SG/sr-4)[ Packagist](https://packagist.org/packages/psg/sr4)[ Docs](https://github.com/php-sg/sr-3)[ RSS](/packages/psg-sr4/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (2)Used By (0)

PSG SR 4 Flexible Layered DI App Standard
=========================================

[](#psg-sr-4-flexible-layered-di-app-standard)

PHP is a language of flexibilty. Why shouldn't our apps be based on a flexible standard - make the framework account for flexibility, and allow the users to have flexibility in the code they write.

By this standard:

- wares shall have a `process` method
- wares (middle, front, back, ...) shall expect injected dependencies into both `__construct` and `process`
- For HTTP Apps:
    - framework shall allow injection for all Sr1 factories and `Pgs\Sr1\ResponseInterface`, `Pgs\Sr1\ServerRequestInterface`, `Pgs\Sr4\ExitResponseInterface`
    - output of wares can include, not limited to, `Pgs\Sr1\ResponseInterface`, `Pgs\Sr1\ServerRequestInterface`, `Pgs\Sr4\ExitResponseInterface`
        - framework shall integrated these into the response and request
- framework shall implement
    - -&gt;get() for retrieving a named service
    - -&gt;set() for adding a named service
    - -&gt;call() for calling something with dependency injection. This can include constructing a class, by providing just the class name.
    - -&gt;data() for retrieving and setting data
        - -&gt;data(key): retrieve
        - -&gt;data(key, value): set

Because interfaces do not allow defining only the presense of a method, the fulfillment of the standard is left up to the programmer (a method defined with no arguments in an interface then requires implementers to make all arguments optional).

Flow
----

[](#flow)

See [SR-2](https://github.com/PHP-SG/sr-2)

SR 2 Variances
--------------

[](#sr-2-variances)

- the parameters and returns are not specified in the interface. This is to allow the framework to accept a variety of returns, including PSR 7 an SR-1 returns, and then integrate those returns
- Coreware now has an interface. It can still be injected as a closure
- Corewars array. It is now possible to have multiple corewares.
    - if you want to remove all coreware:

```
$App->remove(Coreware::class)
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

1752d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4543facab3c88d548b98d8472b532faf7bcd00555cc47c0dc808d935f8d3d73f?d=identicon)[grithin](/maintainers/grithin)

---

Top Contributors

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

---

Tags

phpsr4sr-4

### Embed Badge

![Health badge](/badges/psg-sr4/health.svg)

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

###  Alternatives

[pestphp/pest-plugin-stressless

Stressless plugin for Pest

67792.6k16](/packages/pestphp-pest-plugin-stressless)

PHPackages © 2026

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