PHPackages                             svb/service-factory-bundle - 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. svb/service-factory-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

svb/service-factory-bundle
==========================

Convenient way to automatically inject services into a factory without using sf service tagging.

096.8k↓58.6%[2 PRs](https://github.com/SVB-GmbH/service-factory-bundle/pulls)PHP

Since Feb 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/SVB-GmbH/service-factory-bundle)[ Packagist](https://packagist.org/packages/svb/service-factory-bundle)[ RSS](/packages/svb-service-factory-bundle/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (3)Used By (0)

SVB Service factory bundle
==========================

[](#svb-service-factory-bundle)

Using factories to orchestrate symfony services is usually accomplished by registering a service tag on the service and pass all services with that tag to the factory.

Since 3.4 we got [this](https://symfony.com/blog/new-in-symfony-3-4-simpler-injection-of-tagged-services) pretty little feature to ease the whole process of finding tagged services and injecting them into the factory, but it's still a bit too complicated to use this functionality.

To further improve this, we've decided to provide the AbstractServiceFactory (Factory) and the AbstractFactoryService (Service). To tell the symfony dependency injection which services inheriting AbstractFactoryService need to be added to which factories inheriting AbstractServiceFactory, all services must implement the `getFactoryServiceId` method returning the corresponding factory FQCN.

Installing
----------

[](#installing)

Just run the composer require and composer does the rest!
`php composer.phar require svb/service-factory-bundle`

Example service
---------------

[](#example-service)

```
use SVB\ServiceFactoryBundle\FactoryServiceInterface;

class TestService implements FactoryServiceInterface
{
    public static function getFactoryServiceId(): string
    {
        return TestFactory::class;
    }
}
```

Example factory
---------------

[](#example-factory)

```
use SVB\ServiceFactoryBundle\AbstractServiceFactory;
use SVB\ServiceFactoryBundle\FactoryServiceInterface;

class TestFactory extends AbstractServiceFactory
{
    /**
     * @return FactoryServiceInterface[]
     */
    public function getAllServices(): array
    {
        /**
         * $this->services contains all FactoryServiceInterface inheriting
         * services that return the TestFactory FQCN on getFactoryServiceId
         */
        return $this->services;
    }
}
```

Continuous integration
----------------------

[](#continuous-integration)

Execute unit tests: `./phpunit --coverage-html coverage`

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 75% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11397937?v=4)[Silicon Valley Bank](/maintainers/svb)[@svb](https://github.com/svb)

---

Top Contributors

[![svb-technik](https://avatars.githubusercontent.com/u/99185971?v=4)](https://github.com/svb-technik "svb-technik (6 commits)")[![siemendev](https://avatars.githubusercontent.com/u/11353665?v=4)](https://github.com/siemendev "siemendev (2 commits)")

### Embed Badge

![Health badge](/badges/svb-service-factory-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/svb-service-factory-bundle/health.svg)](https://phpackages.com/packages/svb-service-factory-bundle)
```

###  Alternatives

[zumba/amplitude-php

PHP SDK for Amplitude

4110.3M5](/packages/zumba-amplitude-php)[nattaylor/php-teaser

231.8k](/packages/nattaylor-php-teaser)

PHPackages © 2026

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