PHPackages                             bnf/symfony-service-provider-compiler-pass - 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. bnf/symfony-service-provider-compiler-pass

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

bnf/symfony-service-provider-compiler-pass
==========================================

Symfony compiler pass that allows to use service providers as defined in container-interop/service-provider

1.1.0(7y ago)01.0kMITPHPPHP &gt;=7.1.0

Since Oct 4Pushed 7y ago1 watchersCompare

[ Source](https://github.com/bnf/symfony-service-provider-compiler-pass)[ Packagist](https://packagist.org/packages/bnf/symfony-service-provider-compiler-pass)[ RSS](/packages/bnf-symfony-service-provider-compiler-pass/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (6)Versions (3)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/073faec192c80520923360756f7f3ada0c63114759df111f9d078fb79da4c0cc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f626e662f73796d666f6e792d736572766963652d70726f76696465722d636f6d70696c65722d706173732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/bnf/symfony-service-provider-compiler-pass/?branch=master)[![Build Status](https://camo.githubusercontent.com/bc20b5712f0748565ae009d6c37cb9af59a8ab68104b9ad5309cf80f1bf9c624/68747470733a2f2f7472617669732d63692e6f72672f626e662f73796d666f6e792d736572766963652d70726f76696465722d636f6d70696c65722d706173732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bnf/symfony-service-provider-compiler-pass)[![Coverage Status](https://camo.githubusercontent.com/9f8a3be0366fac28cf5f2751fa07acfe3d6239f5a9a84a044afdb77f5bd98d4f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f626e662f73796d666f6e792d736572766963652d70726f76696465722d636f6d70696c65722d706173732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/bnf/symfony-service-provider-compiler-pass?branch=master)

container-interop/service-provider compiler pass
================================================

[](#container-interopservice-provider-compiler-pass)

Import `service-provider` as defined in `container-interop` into a Symfony dependency injection container.

*This is a fork of [thecodingmachine/service-provider-bridge-bundle](https://github.com/thecodingmachine/service-provider-bridge-bundle)to support Symfony 4. Credits go to David Négrier.*

Usage
-----

[](#usage)

You have to declare service providers manually in the constructor of the registry.

```
$registry = new \Bnf\SymfonyServiceProviderCompilerPass\Registry([
    new MyServiceProvide1(),
    new MyServiceProvide2()
]);
// during compilation set:
$container->addCompilerPass(new \Bnf\SymfonyServiceProviderCompilerPass\Registry($registry, 'service_provider_registry'));
$container->compile();
$container->set('service_provider_registry', $registry);
```

Alternatively, you can also pass the service provider class name. This is interesting because the service-provider registry will not instantiate the service provider unless it is needed for a service. You can therefore improve performances of your application.

```
$registry = new \Bnf\SymfonyServiceProviderCompilerPass\Registry([
    MyServiceProvide1::class,
    MyServiceProvide2::class
]);
// during compilation set:
$container->addCompilerPass(new \Bnf\SymfonyServiceProviderCompilerPass\Registry($registry, 'service_provider_registry'));
$container->compile();
$container->set('service_provider_registry', $registry);
```

Finally, if you need to pass parameters to the constructors of the service providers, you can do this by passing an array:

```
$registry = new \Bnf\SymfonyServiceProviderCompilerPass\Registry([
    [ MyServiceProvide1::class, [ "param1", "param2" ] ],
    [ MyServiceProvide2::class, [ 42 ] ],
]);
// during compilation set:
$container->addCompilerPass(new \Bnf\SymfonyServiceProviderCompilerPass\Registry($registry, 'service_provider_registry'));
$container->compile();
$container->set('service_provider_registry', $registry);
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50.8% 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 ~5 days

Total

2

Last Release

2773d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8b7c224af04cc109194abd9d592618e75e05ec95ad86f2e4381b4bd110f99bd?d=identicon)[bnf](/maintainers/bnf)

---

Top Contributors

[![bnf](https://avatars.githubusercontent.com/u/473155?v=4)](https://github.com/bnf "bnf (33 commits)")[![moufmouf](https://avatars.githubusercontent.com/u/1290952?v=4)](https://github.com/moufmouf "moufmouf (32 commits)")

---

Tags

symfonycontainer-interopPSR-11service provider

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bnf-symfony-service-provider-compiler-pass/health.svg)

```
[![Health](https://phpackages.com/badges/bnf-symfony-service-provider-compiler-pass/health.svg)](https://phpackages.com/packages/bnf-symfony-service-provider-compiler-pass)
```

###  Alternatives

[php-di/php-di

The dependency injection container for humans

2.8k48.9M994](/packages/php-di-php-di)[bnf/phpstan-psr-container

PHPStan dynamic return type extension for PSR-11 ContainerInterface

133.5M53](/packages/bnf-phpstan-psr-container)

PHPackages © 2026

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