PHPackages                             newclass/onus - 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. newclass/onus

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

newclass/onus
=============

PHP Dependency Injection.

v1.0.0(9y ago)0511MITPHPPHP &gt;=5.4.0

Since Dec 2Pushed 9y agoCompare

[ Source](https://github.com/newclass-pl/onus)[ Packagist](https://packagist.org/packages/newclass/onus)[ RSS](/packages/newclass-onus/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (3)Used By (1)

README
======

[](#readme)

[![license](https://camo.githubusercontent.com/4a018965bd8c82cecfad8d9c844dcefc678a887eab90cb8965f025467d3da080/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f626166732f7669612e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/4a018965bd8c82cecfad8d9c844dcefc678a887eab90cb8965f025467d3da080/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f626166732f7669612e7376673f7374796c653d666c61742d737175617265)[![PHP 5.4+](https://camo.githubusercontent.com/4cb8281a28225573129779409c5a37b89b84dcf65c97fb75e966b0aed9bfe73c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d352e342b2d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/4cb8281a28225573129779409c5a37b89b84dcf65c97fb75e966b0aed9bfe73c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d352e342b2d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)

What is Onus?
-------------

[](#what-is-onus)

Onus is a PHP Dependency Injection manager.

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

[](#installation)

The best way to install is to use the composer by command:

composer require newclass/onus

composer install

Use example
-----------

[](#use-example)

```
use Onus\ClassLoader;
use Onus\MetadataClass;
use Onus\MetadataMethod;

$cl=new ClassLoader();

$metadataClass=new MetadataClass('standalone',StandaloneClass::class); //StandaloneClass is your custom class.

$metadataClass->addMethod('__construct')
    ->addArgument(MetadataMethod::PRIMITIVE_TYPE,'value1')
    ->addArgument(MetadataMethod::PRIMITIVE_TYPE,'value2');

$metadataClass->addMethod('setParam3')
    ->addArgument(MetadataMethod::STATIC_TYPE,StandaloneClass::class.'::DATA');

$cl->register($metadataClass);

$metadataClass=new MetadataClass('dependency',DependencyClass::class); //DependencyClass is your custom class.

$metadataClass->addMethod('setStandalone')
    ->addArgument(MetadataMethod::REFERENCE_TYPE,'standalone');

$metadataClass->addMethod('enableFlag');

$cl->register($metadataClass);

$dependencyClass=$cl->get('dependency');

$param1=$dependencyClass->getParam1(); //return "value1"
$param2=$dependencyClass->getParam2(); //return "value2"
$param3=$dependencyClass->getParam3(); //return data1
$flag=$dependencyClass->isFlag(); //return true

```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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

3498d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4acb0470eeb89d512ba7302a6184b091c03a433695340e6a4e87e75fe87bdbc6?d=identicon)[newclass-pl](/maintainers/newclass-pl)

---

Top Contributors

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

---

Tags

composerphp-dependency-injectionphp5

### Embed Badge

![Health badge](/badges/newclass-onus/health.svg)

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

###  Alternatives

[tomatophp/filament-icons

Picker &amp; Table Column &amp; Icons Provider for FilamentPHP

38115.1k13](/packages/tomatophp-filament-icons)[xj/yii2-qrcode-widget

yii2-qrcode-widget

1544.3k](/packages/xj-yii2-qrcode-widget)

PHPackages © 2026

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