PHPackages                             kilahm/ioc-factory-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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. kilahm/ioc-factory-container

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

kilahm/ioc-factory-container
============================

Using attributes, compile your factories into a single class

v0.3.2(11y ago)343MITHack

Since Nov 22Pushed 11y ago1 watchersCompare

[ Source](https://github.com/kilahm/IOCFactoryContainer)[ Packagist](https://packagist.org/packages/kilahm/ioc-factory-container)[ RSS](/packages/kilahm-ioc-factory-container/feed)WikiDiscussions master Synced 1mo ago

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

IOC Factory Container
=====================

[](#ioc-factory-container)

[![Join the chat at https://gitter.im/kilahm/IOCFactoryContainer](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/kilahm/IOCFactoryContainer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![Build Status](https://camo.githubusercontent.com/c0d3f4934390cbc287d1e886403b4b2019a821ee453e743f809ead4810f29e61/68747470733a2f2f7472617669732d63692e6f72672f6b696c61686d2f494f43466163746f7279436f6e7461696e65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kilahm/IOCFactoryContainer) [![HHVM Status](https://camo.githubusercontent.com/7067abc6e9d66c4258c96855edfd631cf81bcf505d6a736c2b4a246cd8158401/687474703a2f2f6868766d2e683463632e64652f62616467652f6b696c61686d2f696f632d666163746f72792d636f6e7461696e65722e737667)](http://hhvm.h4cc.de/package/kilahm/ioc-factory-container)

Compile a type safe IOC Container from user defined attributes.

Use
---

[](#use)

This library includes an executable that will scan your project directory for factories then construct a valid hack file that aliases all your factories as public instance methods of a single class. Your factory methods must accept only a single parameter which is the factory container.

The factory container should only be instantiated once in your application's bootstrap. You should then be able to use the container to instantiate your application class and run it.

### Mark factories with attributes

[](#mark-factories-with-attributes)

Here is an example class with its factory function marked.

```
