library manioc
An IoC container based on Maybe and Pimple
mattjmattj/manioc
An IoC container based on Maybe and Pimple
- Saturday, March 21, 2015
- by mattjmattj
- Repository
- 1 Watchers
- 1 Stars
- 6 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
Manioc
, (*1)
An IoC container based on Maybe and Pimple. Manioc actually directly depends on Pimple 3
and extends it with Maybe., (*2)
Installation
with composer, (*3)
composer.phar require mattjmattj/manioc ~1.0
Basic usage
use Manioc\Container;
[...]
$container = new Container();
// A Manioc container is a Pimple 3 container
$container['feature.foo.enabled'] = false;
$container['Cache'] = function($c) {
new Cache();
}
// ...but with Maybe! Here we use a feature switch to build an instance of Foo
// and wrap it with Maybe. If feature.foo is disabled, Maybe will provide a fake
// object
$container['Foo'] = $container->maybe('Foo',function($c) {
if ($c['feature.foo.enabled']) {
return new Foo();
}
});
// we can also register factories:
$container['Foo'] = $container->maybeFactory('Foo',function($c) {
if ($c['feature.foo.enabled']) {
return new Foo();
}
});
License
Manioc is licensed under BSD-2-Clause license., (*4)
dev-master
9999999-dev
An IoC container based on Maybe and Pimple
Sources
Download
BSD-2-Clause
The Requires
The Development Requires
by
Matthias Jouan
1.0
1.0.0.0
An IoC container based on Maybe and Pimple
Sources
Download
BSD-2-Clause
The Requires
The Development Requires
by
Matthias Jouan