PHPackages                             crishellco/rivet-ioc - 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. crishellco/rivet-ioc

ActiveLibrary[Framework](/categories/framework)

crishellco/rivet-ioc
====================

A simple auto-wiring IoC container for PHP

1.1.3(8y ago)1346MITPHPPHP &gt;=5.4.0

Since Dec 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/crishellco/rivet-ioc)[ Packagist](https://packagist.org/packages/crishellco/rivet-ioc)[ RSS](/packages/crishellco-rivet-ioc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (3)Used By (0)

RivetIoc
========

[](#rivetioc)

[![Build Status](https://camo.githubusercontent.com/8eec085aed39fbe47fb9710fcd6204ca475dcfab5a0fd8d59b16244ac04e025e/68747470733a2f2f7472617669732d63692e6f72672f6372697368656c6c636f2f72697665742d696f632e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/crishellco/rivet-ioc)

RivetIoc is an auto-wiring (zero configuration) IoC container for PHP to easily manage class dependencies. It features both auto-wiring of dependencies using reflection as well as manual registration for depenency injection.

Features
--------

[](#features)

- Auto-wiring (zero configuration) dependency injection
    - Recursive dependency injection
- Manual registration for more complex dependency management
- Locator trait which exposes commonly used RivetIoc\\Ioc methods

Getting Started
---------------

[](#getting-started)

### Install

[](#install)

```
$ composer require crishellco/rivet-ioc

```

### System Requirements

[](#system-requirements)

**PHP &gt;= 5.4.0**

Documentation
-------------

[](#documentation)

### Auto-wiring

[](#auto-wiring)

**Define your classes using type hints**

```
namespace App;
class DbDriver
{
    ...
}
```

```
namespace App;
class Db
{
    protected $driver;

    public function __construct(DbDriver $driver)
    {
        $this->driver = $driver;
    }
}
```

```
namespace App\Services;
class UserService
{
    protected $db;

    public function __construct(Db $db)
    {
        $this->db = $db;
    }
}
```

**Use RivetIoc to create a new class instance**

RivetIoc will use constructor type hints to automatically create and inject dependencies

```
$userService = \RivetIoc\Ioc::instance()->make('App\Services\UserService');

// Or use the helper function...
$userService = rivet_make('App\Services\UserService');
```

### Manual dependency registration

[](#manual-dependency-registration)

**Register your dependencies in your application bootstrap**

```
\RivetIoc\Ioc::instance()->register('App\Db', function() {
    $mysqli = new mysqli('localhost', 'username', 'password', 'mydb');
    $db = new App\Db($mysqli);

    return $db;
});
```

**Use RivetIoc to create a new class instance**

RivetIoc will use the registered closure to create and inject dependencies

```
$db = \RivetIoc\Ioc::instance()->make('App\Db');

// Or use the helper function...
$db = rivet_make('App\Db');
```

**Forget a manually registered dependency**

```
register_shutdown_function(function() {
    \RivetIoc\Ioc::instance()->forget('App\Db');
});
```

### Locator trait

[](#locator-trait)

Use the RivetIoc\\Traits\\Locator trait in a class give access to commonly used RivetIoc\\Ioc methods:

- make
- register
- forget

```
namespace App\Services;
class UserService
{
    use \RivetIoc\Traits\Locator;

    protected $dao;

    public function __construct()
    {
        $this->dao = $this->make('App\Doa\UserDao');

        // Or use the helper function...
        $this->dao = rivet_make('App\Doa\UserDao');
    }
}
```

How to Contribute
-----------------

[](#how-to-contribute)

### Pull Requests

[](#pull-requests)

1. Fork the RivetIoc repository
2. Create a new branch for each feature or improvement
3. Send a pull request from each feature branch to the **develop** branch

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

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

3062d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b66b3d5a5e67f01f364c920bae7b46df03528abb4ada1da7ca85df03f1fc261?d=identicon)[crishellco](/maintainers/crishellco)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/crishellco-rivet-ioc/health.svg)

```
[![Health](https://phpackages.com/badges/crishellco-rivet-ioc/health.svg)](https://phpackages.com/packages/crishellco-rivet-ioc)
```

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

712181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)[laravel/pail

Easily delve into your Laravel application's log files directly from the command line.

91545.3M590](/packages/laravel-pail)

PHPackages © 2026

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