PHPackages                             mattferris/provider - 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. mattferris/provider

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

mattferris/provider
===================

Implementation standard for consumer/provider interfaces

0.3(9y ago)04506PHP

Since Oct 22Pushed 9y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (5)Used By (6)

Provider
========

[](#provider)

Common interfaces `ProviderInterface` and `ConsumerInterface` for inverting control of configuration. This allows a *consumer* to pass control to a *provider* so that the *provider* can configure the *consumer*.

The *consumer* must implement a `register()` method and the provider must implement a `provides()` method. An instance of *provider* is passed to `register()`, and `register()` in turn calls `provides()`, passing an instance of itself. This then allows the *provider* to call methods on the *consumer* and configure as needed.

In practice, this might look like:

```
use MattFerris\Provider\ConsumerInterface;
use MattFerris\Provider\ProviderInterface;

// service container which contains service definitions
class ServiceContainer implements ConsumerInterface
{
    public function register(ProviderInterface $provider)
    {
        $provider->provides($this);
        return $this;
    }

    ...
}

class DatabaseProvider implements ProviderInterface
{
    public function provides(ConsumerInterface $consumer)
    {
        $consumer->set('DatabaseService', $databaseServiceDefinition);
    }
}

$container = new ServiceContainer();
$container->register(new DatabaseProvider());
$db = $container->get('DatabaseService');
$db->query(...);
```

*Note*: `ProviderInterface` doesn't type-hint what kind of *consumer* it expects. This is on purpose, as *providers* implementing the interface can then validate the *consumer* based on what type they want. If a *consumer* isn't of they correct type, *providers* can throw an `InvalidConsumerException`.

Taking this example further, if an application contains multiple packages that each provide services, packages can configure their services automatically by implementing their own *providers*.

```
$container = new ServiceContainer();
$container
    ->register(new DatabasePackage\ServiceProvider())
    ->register(new Authentication\ServiceProvider())
    ->register(new EventDispatcher\ServiceProvider());
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity56

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

Every ~220 days

Total

3

Last Release

3422d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d3d46e7fdc93a3d67119773bdae779e281a87f2d70e95568a969c72205aedf7?d=identicon)[mattferris](/maintainers/mattferris)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/mattferris-provider/health.svg)

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

###  Alternatives

[phpdocumentor/type-resolver

A PSR-5 based resolver of Class names, Types and Structural Element Names

9.2k719.5M166](/packages/phpdocumentor-type-resolver)[pimple/pimple

Pimple, a simple Dependency Injection Container

2.7k130.5M1.4k](/packages/pimple-pimple)[league/container

A fast and intuitive dependency injection container.

86387.8M343](/packages/league-container)[stella-maris/clock

A pre-release of the proposed PSR-20 Clock-Interface

7947.5M2](/packages/stella-maris-clock)[wptrt/wpthemereview

PHP\_CodeSniffer rules (sniffs) to verify theme compliance with the rules for theme hosting on wordpress.org

217736.5k29](/packages/wptrt-wpthemereview)[inpsyde/modularity

Modular PSR-11 implementation for WordPress plugins, themes or libraries.

54383.3k3](/packages/inpsyde-modularity)

PHPackages © 2026

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