PHPackages                             chippyash/slim-symfony-dic - 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. chippyash/slim-symfony-dic

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

chippyash/slim-symfony-dic
==========================

Symfony 2 DIC integration for the Slim Framework 3

3.1.1(7y ago)34.3k31BSD-3-ClausePHPPHP ~5.6||~7.1CI failing

Since Jan 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/chippyash/Slim-Symfony-Dic)[ Packagist](https://packagist.org/packages/chippyash/slim-symfony-dic)[ Docs](http://zf4.biz/packages?utm_source=packagist&utm_medium=web&utm_campaign=blinks&utm_content=slimsymfonydic)[ RSS](/packages/chippyash-slim-symfony-dic/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (9)Versions (13)Used By (1)

chippyash/Slim-Symfony-Dic
==========================

[](#chippyashslim-symfony-dic)

Quality Assurance
-----------------

[](#quality-assurance)

[![PHP 5.6](https://camo.githubusercontent.com/88093c79af42bd3c07f4d6aa378289e1f5450411c56753b0323bd7d8b9b1f9ee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d352e362d626c75652e737667)](https://camo.githubusercontent.com/88093c79af42bd3c07f4d6aa378289e1f5450411c56753b0323bd7d8b9b1f9ee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d352e362d626c75652e737667)[![PHP 7.1](https://camo.githubusercontent.com/d29ceb6206232af72a55b5ed3e6fab0a1f2d6cb6c728a088c9c18c4b035a0765/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e312d626c75652e737667)](https://camo.githubusercontent.com/d29ceb6206232af72a55b5ed3e6fab0a1f2d6cb6c728a088c9c18c4b035a0765/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e312d626c75652e737667)[![Build Status](https://camo.githubusercontent.com/b685728d8a7b847ef4899ca5691dd8bd5bbaf3cda86e394902c7691e5e04cbc2/68747470733a2f2f7472617669732d63692e6f72672f6368697070796173682f536c696d2d53796d666f6e792d4469632e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/chippyash/Slim-Symfony-Dic)[![Code Climate](https://camo.githubusercontent.com/6abf90fcf90f88b9a07fc73810bbbcdfc2072ab5267fe0013eb2f516db11336a/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6368697070796173682f536c696d2d53796d666f6e792d4469632f6261646765732f6770612e737667)](https://codeclimate.com/github/chippyash/Slim-Symfony-Dic)[![Test Coverage](https://camo.githubusercontent.com/1eadf4876117f117ba09efa08fa46330ae4c1cd62d71f7dee7570d2ef4480582/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6368697070796173682f536c696d2d53796d666f6e792d4469632f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/chippyash/Slim-Symfony-Dic/coverage)

The above badges represent the current development branch. As a rule, I don't push to GitHub unless tests, coverage and usability are acceptable. This may not be true for short periods of time; on holiday, need code for some other downstream project etc. If you need stable code, use a tagged version. Read 'Installation'.

See the tests and the [Test Contract](https://github.com/chippyash/Slim-Symfony-Dic/blob/master/docs/Test-Contract.md) for additional information.

Please note that developer support for PHP5.5 was withdrawn at version 3.0.0 of this library. If you need support for PHP 5.5, please use a version `>=2,setParameter('foo', 'bar');
    //set up a synthetic
    $dic->setDefinition('bar', (new Definition())->setSynthetic(true));
});

$app = new App(Builder::buildDic(new StringType($xmlDiFileLocation)));
```

### Register a PostCompile function

[](#register-a-postcompile-function)

The PostCompile function is called just after compiling the container.

The post compile function only really makes sense to set a synthetic definition as after compilation the rest of the DI Container is frozen and cannot be changed.

```
use Slimdic\Dic\ServiceContainer;

Builder::registerPreCompileFunction(function($dic) {
    $dic->setDefinition('foo', (new Definition())->setSynthetic(true));
});

Builder::registerPostCompileFunction(function($dic, $stage) {
    $dic->set('foo', $myFooService);
});
```

Changing the library
--------------------

[](#changing-the-library)

1. fork it
2. write the test
3. amend it
4. do a pull request

Found a bug you can't figure out?

1. fork it
2. write the test
3. do a pull request

or raise an issue ticket

NB. Make sure you rebase to HEAD before your pull request

Where?
------

[](#where)

The library is hosted at [Github](https://github.com/chippyash/Slim-Symfony-Dic). It is available at [Packagist.org](https://packagist.org/packages/chippyash/slim-symfony-dic)

Check out [ZF4 Packages](http://zf4.biz/packages?utm_source=github&utm_medium=web&utm_campaign=blinks&utm_content=slimsymfonydic) for more packages

See [My blog](http://zf4.biz) for ramblings on coding and curries

### Installation

[](#installation)

Install [Composer](https://getcomposer.org/)

#### For production

[](#for-production)

```
    "chippyash/slim-symfony-dic": ">=3,
