PHPackages                             enzyme/laravel-binder - 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. enzyme/laravel-binder

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

enzyme/laravel-binder
=====================

A service container contextual binding helper for Laravel 5.

v1.0.0(10y ago)125MITPHPPHP &gt;=5.5.0

Since Jan 20Pushed 9y ago1 watchersCompare

[ Source](https://github.com/enzyme/laravel-binder)[ Packagist](https://packagist.org/packages/enzyme/laravel-binder)[ Docs](https://github.com/enzyme/laravel-binder)[ RSS](/packages/enzyme-laravel-binder/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (4)Versions (6)Used By (0)

Binder
======

[](#binder)

[![Build Status](https://camo.githubusercontent.com/6d38f8dba6d67d11a350ab102fc41cca8889d9b49628f57fe37ed595d081500d/68747470733a2f2f7472617669732d63692e6f72672f656e7a796d652f6c61726176656c2d62696e6465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/enzyme/laravel-binder)[![Coverage Status](https://camo.githubusercontent.com/a2bee32a7382a03b56d80f5971b2974ca891f3e722b460a17bc5f27c2d18ab57/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f656e7a796d652f6c61726176656c2d62696e6465722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/enzyme/laravel-binder?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9344b71db1e7ed4969efb1db69736c973e3207b6dc0436f270f2ba1c2620cf50/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656e7a796d652f6c61726176656c2d62696e6465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/enzyme/laravel-binder/?branch=master)

A contextual binding helper for Laravel 5.

Example
=======

[](#example)

#### From the service provider.

[](#from-the-service-provider)

```
use Enzyme\LaravelBinder\Binder;

// Inside the app service provider...
public function register()
{
    $binder = new Binder($this->app);

    $binder->setAlias(
        'controller.listing',
        'App\Http\Controllers\ListingController'
    );

    $binder->setAlias(
        'repos.interface',
        'Acme\Repositories\RepositoryInterface'
    );

    // Option 1 for binding, using aliases.
    $binder->setBinding(
        'repos.listing',
        'repos.interface',
        'Acme\Repositories\ListingRepository'
    );

    // Option 2 for binding, using FQNs.
    $binder->setBinding(
        'factories.listing',
        'Acme\Factories\FactoryInterface',
        'Acme\Factories\ListingFactory'
    );

    // Tell the service container that the ListingController
    // needs the ListingRepository & ListingFactory.
    $binder->setNeeds(
        'controller.listing',
        ['repos.listing', 'factories.listing']
    );

    $binder->register();
}
```

#### From the controller

[](#from-the-controller)

```
// You don't need to inject the specific concrete classes, just the
// interfaces. The Binder + Service Container has taken care of it for you.
public function __construct(RepositoryInterface $repo, FactoryInterface $factory)
{
    $this->repo = $repo;
    $this->factory = $factory;
}
```

What's the purpose?
===================

[](#whats-the-purpose)

With your service provider(s) now being the sole authority for which classes get what implementations, if you ever need to switch those implementations, it's dead simple and in one spot!

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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

Every ~24 days

Total

4

Last Release

3690d ago

Major Versions

v0.2.1 → v1.0.02016-04-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/148afe40f056b8f57e43ed0505c6040f762e26805b1d1bebed87484d529bae07?d=identicon)[r3oath](/maintainers/r3oath)

---

Top Contributors

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

---

Tags

phpcontainerlaravelservicecontextualbindingenzyme

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/enzyme-laravel-binder/health.svg)

```
[![Health](https://phpackages.com/badges/enzyme-laravel-binder/health.svg)](https://phpackages.com/packages/enzyme-laravel-binder)
```

###  Alternatives

[daylerees/container-debug

Inspect the Laravel IoC Container from Artisan.

582.8k](/packages/daylerees-container-debug)

PHPackages © 2026

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