bleicker / objectmanager
There is no license information available for the latest version (1.1.3) of this package.
1.1.3
2015-05-10 09:17 UTC
Requires
- bleicker/container: ~1.0
- bleicker/exception: ~1.0
Requires (Dev)
README
ObjectManager is a container to register objects
Usage
- ObjectManager::register(MyClassInterface::class, new MyClass('foo', 'bar'));
- Getting the Object everywhere in your Code with ObjectManager::get(MyClassInterface::class);
Registering a Closure as Factory
- ObjectManager::register(MyClassInterface::class, function(){new MyClass()});
- To make it a singleton just register it as this: ObjectManager::makeSingleton(MyClassInterface::class);
- Getting the Object everywhere in your Code with ObjectManager::get(MyClassInterface::class);