PHPackages                             huge/ioc - 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. huge/ioc

ActiveLibrary[Framework](/categories/framework)

huge/ioc
========

Framework IoC simple d'utilisation et efficace. HugeIoC permet de gérer et d'injecter des objets php très simple.

v2.2.0(11y ago)31621MITPHPPHP &gt;=5.3.3

Since Jul 12Pushed 11y ago1 watchersCompare

[ Source](https://github.com/ffremont/HugeIoC)[ Packagist](https://packagist.org/packages/huge/ioc)[ RSS](/packages/huge-ioc/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (5)Versions (19)Used By (1)

Huge IoC
========

[](#huge-ioc)

Framework IoC Simple et efficace pour php5. Le principe de cette librairie est de gérer les instances des objets PHP à votre place. De cette façon vous n'êtes plus obligé de gérer vous-même dans vos constructeurs les instances en paramètres. Il est possible d'injecter via une annotation @Autowired.

Installation
------------

[](#installation)

- Installer avec composer

```
    {
        "require": {
           "huge/ioc": "..."
        }
    }
```

- Cache :
- Initialisation

```
  $loader = require(__DIR__.'/../../../vendor/autoload.php');

  // nécessaire charger les annotations
  \Huge\IoC\Container\SuperIoC::registerLoader(array($loader, 'loadClass'));
```

\## Fonctionnalités

- Définition d'un bean : @Component
- Gestion de plusieurs conteneurs d'objets
- Injection des instances via l'annotation @Autowired("ID\_BEAN")
- Injection d'une implémentation via l'annotation @Autowired("INTERFACE")
- Injection d'une sous classe via l'annotation @Autowired("CLASSE\_PARENTE")
- Gère l'instanciation request ou lazy (sur demande)
- Surcharge IFactory pour l'instanciation
- Création de conteneur spécifique possible (entends SuperIoC)
- Cache : basé sur doctrine cache
- Annotations basé sur doctrine annotations

Conteneurs
----------

[](#conteneurs)

- Etendre \\Huge\\IoC\\Container\\SuperIoC

```
    namespace MyApp;

    class GarageIoC extends \Huge\IoC\Container\SuperIoC{
            public function __construct($config) {
                parent::__construct(__CLASS__, '1.0');

                $memcache = new Memcache();
                $memcache->connect($config['memcache.host'], $config['memcache.port']);
                $cache = new \Doctrine\Common\Cache\MemcacheCache();
                $cache->setMemcache($memcache);

                $this->setCacheImpl($cache);
                $this->addDefinitions(array(
                    array(
                        'class' => 'Huge\IoC\Fixtures\Contact',
                        'factory' => new \Huge\Io\Factory\ConstructFactory(array('DUPUIT', 'Pierre'))
                    )
                ));
                $this->addOtherContainers(array(
                    new AudiIoC(),
                    new RenaultIoC()
                ));
            }
    }
```

- Attention, il est nécessaire de mettre à jour la version en cas de relivraison (rafraîchissement du cache)

Factories
---------

[](#factories)

1. Créer vos factories : implémenter Huge\\IoC\\Factory\\IFactory

```
    namespace MyApp;

    class MyNullFactoy implements \Huge\IoC\Factory\IFactory{
            public function __construct() {}

            public function create($classname) {
                        return null;
            }
    }
```

```
$c = new DefaultIoC();
$c->addDefinitions(array(
    array('class' => 'MyClass', 'factory' => new MyNullFactory())
));
```

Injecter les instances
----------------------

[](#injecter-les-instances)

Injecter dans vos beans d'autres beans

```
    use Huge\IoC\Annotations\Component;
    use Huge\IoC\Annotations\Autowired;

    /**
    * @Component
    */
    class MyController{
        /**
        * @Autowired("MyApp\MyCustomIoC")
        */
        private $ioc;

        /**
        * @Autowired("Huge\IoC\Fixtures\Contact");
        */
        private $daoContact;

        /**
         * @Autowired("Huge\IoC\Factory\ILogFactory")
         * @var \Huge\IoC\Factory\ILogFactory
         */
        private $loggerFactory;

        /**
        * Nécessaire au conteneur pour setter la valeur
        */
        public function setIoc($ioc){
            $this->ioc = $ioc;
        }
        public function setDaoContact($contact){
            $this->daoContact = $contact;
        }

        public function getLoggerFactory() {
            return $this->loggerFactory;
        }

        public function setLoggerFactory(\Huge\IoC\Factory\ILogFactory $loggerFactory) {
            $this->loggerFactory = $loggerFactory;
        }
    }
```

\## Limitations

- Cache Doctrine
- Annotations Doctrine
- Logger basé sur l'interface Psr\\Log

Cache
-----

[](#cache)

Utilisation des implémentations Doctrine\\Common\\Cache\\Cache

```
    $c = new DefaultIoC('default', '1.0');
    $c->setCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
```

Attention, les définitions des beans est mise en cache, par conséquent, les paramètres donnés au RUN le sont aussi.

Logger
------

[](#logger)

1. Implémentation du composant factory : Huge\\IoC\\Factory\\ILogFactory

```
$ioc = new DefaultIoC();
$ioc->setLogger(new MyApp\Log4phpLoggerImpl('DefaultIoC'));
$ioc->addDefinitions(array(
    array(
        'class' => 'MyApp\Log4phpFactoryImpl',
        'factory' => SimpleFactory::getInstance() // retourne un singleton (optimisation)
    )
));
```

2. Plus d'information :

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~3 days

Total

18

Last Release

4321d ago

Major Versions

0.1 → 1.0-beta2014-07-12

1.2.0 → 2.0.0-BETA2014-07-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/4fdc59a962708456dade186f976e91c3cddff1db2253d8739051810da9d65012?d=identicon)[floorent](/maintainers/floorent)

---

Top Contributors

[![ffremont](https://avatars.githubusercontent.com/u/5568721?v=4)](https://github.com/ffremont "ffremont (76 commits)")

---

Tags

loaderiocsingletoninjectorbean

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/huge-ioc/health.svg)

```
[![Health](https://phpackages.com/badges/huge-ioc/health.svg)](https://phpackages.com/packages/huge-ioc)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[drupal/core

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

21866.0M1.7k](/packages/drupal-core)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)

PHPackages © 2026

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