PHPackages                             inviqa/symfony-container-generator - 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. inviqa/symfony-container-generator

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

inviqa/symfony-container-generator
==================================

Generic Symfony DI Container Builder

1.2.0(9y ago)541.7k8[1 PRs](https://github.com/inviqa/symfony-container-generator/pulls)1PHPPHP &gt;=5.3.3

Since May 17Pushed 9y ago19 watchersCompare

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

READMEChangelog (1)Dependencies (6)Versions (19)Used By (1)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c65e87697ca5452ef0cedf74dc91776ee5b8b5f61a2f89bf6d7522a0dab0face/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f696e766971612f73796d666f6e792d636f6e7461696e65722d67656e657261746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/inviqa/symfony-container-generator/?branch=master)[![Build Status](https://camo.githubusercontent.com/31d5de5b506b6c3338aa963edaeaef8e8795d169b9f42e9c78dc4b0b338e8319/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f696e766971612f73796d666f6e792d636f6e7461696e65722d67656e657261746f722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/inviqa/symfony-container-generator/build-status/master)

symfony-container-generator
===========================

[](#symfony-container-generator)

Generates and caches a standalone Symfony DI container. You can use this to easily use Symfonys DI Container in any legacy project, all you need to provide is a list of folders where the DI Container configuration is stored, whether you are in debug or production mode, and the format your configuration files are in.

Usage
-----

[](#usage)

Create a new Configuration object

```
$generatorConfiguration = ContainerTools\Configuration::fromParameters(
    '/var/cache/container.php',              // name of file for compiled container
    ['/etc/services/', '/project/services'], // where to expect services.xml and services_test.xml
    true |                                   // debug mode - caches container.php with meta file and only regenerates when resources are modified
    false,                                   // production mode - caches container.php and doesn't regenerate unless deleted
    'xml'|'yml'                              // services extension 'xml' or 'yml'
);
```

Instantiate a ContainerGenerator, and fetch the container from it:

```
    $generator = new \ContainerTools\ContainerGenerator($generatorConfiguration);

    $container = $generator->getContainer();

    $mailer = $container->get('acme.mailer');
```

ContainerGenerator expects at least one services.xml file to exist, and will throw an exception if none are found.

If you need to define [lazy services](http://symfony.com/doc/current/service_container/lazy_services.html), install the ProxyManager Bridge package:

```
    composer require symfony/proxy-manager-bridge
```

Test Services
-------------

[](#test-services)

Sometimes it's neccessary, in a test environment, to provide mock services that replace the real services, these can be provided in services\_test.xml and use the configuration switch:

```
$generatorConfiguration->setTestEnvironment(true);
```

If any service\_test.xml files exist they will be loaded subsequently. Symfony's configuration loader will merge the configurations and override test service definitions with production ones. (similarly for services.yml if 'yml' is configured)

As of version 0.3.0 ContainerGenerator uses the ConfigCache component, which keeps track of resources and regenerated the cached container only when a resource is modified. This means that if debug mode is enabled, a file called `/var/cache/container.php.meta` will be generated in the same folder as the cached container.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~49 days

Recently: every ~158 days

Total

16

Last Release

3287d ago

Major Versions

0.3.0 → 1.0.02016-04-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b33b247b870cf3add3d95961e04f7b87c63d0817af5c373837c28ae3c1aeaf0?d=identicon)[inviqa-session](/maintainers/inviqa-session)

![](https://www.gravatar.com/avatar/eae883afb6f3957e356498002d9503438dc23cc38cdf32aa5d20e463452756f6?d=identicon)[jon-acker](/maintainers/jon-acker)

---

Top Contributors

[![ubick](https://avatars.githubusercontent.com/u/904477?v=4)](https://github.com/ubick "ubick (3 commits)")[![petemcfarlane](https://avatars.githubusercontent.com/u/3472717?v=4)](https://github.com/petemcfarlane "petemcfarlane (2 commits)")[![adragus-inviqa](https://avatars.githubusercontent.com/u/13104649?v=4)](https://github.com/adragus-inviqa "adragus-inviqa (1 commits)")[![ciaranmcnulty](https://avatars.githubusercontent.com/u/237866?v=4)](https://github.com/ciaranmcnulty "ciaranmcnulty (1 commits)")[![nevvermind](https://avatars.githubusercontent.com/u/834932?v=4)](https://github.com/nevvermind "nevvermind (1 commits)")

###  Code Quality

TestsBehat

### Embed Badge

![Health badge](/badges/inviqa-symfony-container-generator/health.svg)

```
[![Health](https://phpackages.com/badges/inviqa-symfony-container-generator/health.svg)](https://phpackages.com/packages/inviqa-symfony-container-generator)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[shyim/danger-php

Port of danger to PHP

8544.9k](/packages/shyim-danger-php)[symfony/ai-bundle

Integration bundle for Symfony AI components

30282.3k6](/packages/symfony-ai-bundle)

PHPackages © 2026

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