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

This package is not auto-updated.

Last update: 2024-11-09 17:30:10 UTC


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);