Download the PHP package merophp/object-manager without Composer
On this page you can find all versions of the php package merophp/object-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download merophp/object-manager
More information about merophp/object-manager
Files in merophp/object-manager
Download merophp/object-manager
More information about merophp/object-manager
Files in merophp/object-manager
Vendor merophp
Package object-manager
Short Description Object manager with dependency injection for the Merophp Framework
License MIT
Package object-manager
Short Description Object manager with dependency injection for the Merophp Framework
License MIT
Please rate this library. Is it a good library?
Informations about the package object-manager
Introduction
Object manager with dependency injection for the Merophp Framework.
Installation
Via composer:
composer require merophp/object-manager
Basic Usage
require_once 'vendor/autoload.php';
use Merophp\ObjectManager\ObjectContainer;
use Merophp\ObjectManager\ObjectManager;
$oc = new ObjectContainer;
ObjectManager::setObjectContainer($oc);
$myInstance = ObjectManager::get(MyClass::class);
Dependency Injection
The object manager will scan the classes he has to instantiate for injection methods will use them to inject the dependencies.
require_once 'vendor/autoload.php';
use Merophp\ObjectManager\ObjectContainer;
use Merophp\ObjectManager\ObjectManager;
class Foo
{
public Bar $bar = null;
public function injectBar(Bar $bar)
{
$this->bar = $bar;
}
public function getBar()
{
return $this->bar;
}
}
$myFooInstance = ObjectManager::get(Foo::class);
$myBarInstance = $myFooInstance->getBar();
By instantiating from class Foo the object manager will also instantiate the dependency Bar.
All versions of object-manager with dependencies
PHP Build Version
Package Version
The package merophp/object-manager contains the following files
Loading the files please wait ....