PHPackages                             flexsounds/slim-symfony-di-container - 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. [Framework](/categories/framework)
4. /
5. flexsounds/slim-symfony-di-container

ActiveLibrary[Framework](/categories/framework)

flexsounds/slim-symfony-di-container
====================================

The bridge to use the Symfony Dependency Injection Container to use in Slim Framework 3

1.0.3(7y ago)348.9k1[1 PRs](https://github.com/leroy0211/Slim-Symfony-Dependency-Injection-Bridge/pulls)MITPHPPHP ^5.5.9 || ^7.0CI failing

Since Aug 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/leroy0211/Slim-Symfony-Dependency-Injection-Bridge)[ Packagist](https://packagist.org/packages/flexsounds/slim-symfony-di-container)[ RSS](/packages/flexsounds-slim-symfony-di-container/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (5)Versions (9)Used By (0)

[![Travis Build Status](https://camo.githubusercontent.com/0acfc2503c91a48c788c29bb329ee60d79a3cace459802f790de21f8c896daaa/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c65726f79303231312f536c696d2d53796d666f6e792d446570656e64656e63792d496e6a656374696f6e2d4272696467652f6d61737465722e7376673f6d61784167653d323539323030303f7374796c653d666c61742d737175617265)](https://travis-ci.org/leroy0211/Slim-Symfony-Dependency-Injection-Bridge)[![Packagist](https://camo.githubusercontent.com/6d4d2f1f2031993c5a8cbd75731a0374a771367e8340001ab9ecc949144acac4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666c6578736f756e64732f736c696d2d73796d666f6e792d64692d636f6e7461696e65722e7376673f6d61784167653d323539323030303f7374796c653d666c61742d737175617265)](https://packagist.org/packages/flexsounds/slim-symfony-di-container)[![Packagist](https://camo.githubusercontent.com/745c3b720201793c354ec97f88dab6ee74206f553627156600f01e6cb6110863/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666c6578736f756e64732f736c696d2d73796d666f6e792d64692d636f6e7461696e65722e7376673f6d61784167653d323539323030303f7374796c653d666c61742d737175617265)](https://packagist.org/packages/flexsounds/slim-symfony-di-container)

Slim-Symfony-Dependency-Injection-Bridge
========================================

[](#slim-symfony-dependency-injection-bridge)

Just a simple bridge to use the Symfony Dependency Injection Container to replace the Container in Slim Framework 3

This will replace the `pimple` container which comes default with Slim Framework 3.

The default services (like `router`, `request`, `response`) which Slim Framework uses, are preloaded in the `ContainerBuilder`. This way Slim will work as it should.

Installation
============

[](#installation)

Use composer to install

`composer require flexsounds/slim-symfony-di-container`

Default usage
=============

[](#default-usage)

To use the Symfony DI Container just add the ContainerBuilder to `Slim\App`

```
$container = new \Flexsounds\Component\SymfonyContainerSlimBridge\ContainerBuilder();

$app = new \Slim\App($container);

// define your routes here. The container is available through $this in the route closure

$app->run();
```

Default parameters
==================

[](#default-parameters)

The default Slim Framework Settings are 1 on 1 mapped with parameters. To overwrite the settings you can either create a new `ParameterBag` with your settings and pass it as the first argument to the `ContainerBuilder`. Or if you use one of the file loaders, change them with the parameters config key.

Just change the parameters to your own choice to your config file like this.

```
parameters:
   httpVersion: "1.1"
   responseChunkSize: 4096
   outputBuffering: "append"
   determineRouteBeforeAppMiddleware: false
   displayErrorDetails: false

```

Other Examples
==============

[](#other-examples)

Example loading your dependencies through yaml configuration (The Symfony way)
------------------------------------------------------------------------------

[](#example-loading-your-dependencies-through-yaml-configuration-the-symfony-way)

```
$container = new \Flexsounds\Component\SymfonyContainerSlimBridge\ContainerBuilder();
$loader = new \Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new \Symfony\Component\Config\FileLocator(__DIR__));
$loader->load('config.yml');

$app = new \Slim\App($container);

$app->run();
```

Now you can create a `config.yml` file to load your services, parameters, etc. [The use of importing other config files is also available.](http://symfony.com/doc/current/cookbook/configuration/configuration_organization.html#different-directories-per-environment)

```
services:
  my.custom.service:
    class: Location\To\The\Class
```

Now the service `my.custom.service` is available in the container. Use `$this->get('my.custom.service')` to load the service.

```
$app->get('/', function($request, $response){
  $customService = $this->get('my.custom.service'); // $customService is now an instance of Location\To\The\Class()
});
```

Read more
=========

[](#read-more)

Read the [symfony service container documentation](http://symfony.com/doc/current/book/service_container.html) to find out what other options are available in the service container.

Read the [symfony dependency injection documentation](http://symfony.com/doc/current/components/dependency_injection/introduction.html) to find out how the ContainerBuilder is used. Like setting default parameters.

Interesting to know
===================

[](#interesting-to-know)

If you use PhpStorm as IDE and add the Symfony Plugin, typehinting for services should be available.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 92.3% 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 ~191 days

Recently: every ~163 days

Total

6

Last Release

2613d ago

Major Versions

1.x-dev → 2.0.0-RC12019-03-17

PHP version history (3 changes)1.0.0PHP &gt;=5.5.0

1.0.3PHP ^5.5.9 || ^7.0

1.x-devPHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b82e8f8f4f040f19cbd9172d80a84a6e6d68912fa774b5675512dc1f3552f91?d=identicon)[devnul](/maintainers/devnul)

---

Top Contributors

[![leroy0211](https://avatars.githubusercontent.com/u/2051658?v=4)](https://github.com/leroy0211 "leroy0211 (12 commits)")[![ondraondra81](https://avatars.githubusercontent.com/u/4330263?v=4)](https://github.com/ondraondra81 "ondraondra81 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/flexsounds-slim-symfony-di-container/health.svg)

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

###  Alternatives

[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k235.4M9.7k](/packages/symfony-framework-bundle)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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