library onus
PHP Dependency Injection.
newclass/onus
PHP Dependency Injection.
- Friday, December 2, 2016
- by newclass-pl
- Repository
- 0 Watchers
- 0 Stars
- 27 Installations
- PHP
- 1 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 3 Versions
- 0 % Grown
README
, (*1)
What is Onus?
Onus is a PHP Dependency Injection manager., (*2)
Installation
The best way to install is to use the composer by command:, (*3)
composer require newclass/onus, (*4)
composer install, (*5)
Use example
use Onus\ClassLoader;
use Onus\MetadataClass;
use Onus\MetadataMethod;
$cl=new ClassLoader();
$metadataClass=new MetadataClass('standalone',StandaloneClass::class); //StandaloneClass is your custom class.
$metadataClass->addMethod('__construct')
->addArgument(MetadataMethod::PRIMITIVE_TYPE,'value1')
->addArgument(MetadataMethod::PRIMITIVE_TYPE,'value2');
$metadataClass->addMethod('setParam3')
->addArgument(MetadataMethod::STATIC_TYPE,StandaloneClass::class.'::DATA');
$cl->register($metadataClass);
$metadataClass=new MetadataClass('dependency',DependencyClass::class); //DependencyClass is your custom class.
$metadataClass->addMethod('setStandalone')
->addArgument(MetadataMethod::REFERENCE_TYPE,'standalone');
$metadataClass->addMethod('enableFlag');
$cl->register($metadataClass);
$dependencyClass=$cl->get('dependency');
$param1=$dependencyClass->getParam1(); //return "value1"
$param2=$dependencyClass->getParam2(); //return "value2"
$param3=$dependencyClass->getParam3(); //return data1
$flag=$dependencyClass->isFlag(); //return true
dev-master
9999999-dev
PHP Dependency Injection.
Sources
Download
MIT
The Requires
by
Michal Tomczak
dev-develop
dev-develop
PHP Dependency Injection.
Sources
Download
MIT
The Requires
by
Michal Tomczak
v1.0.0
1.0.0.0
PHP Dependency Injection.
Sources
Download
MIT
The Requires
by
Michal Tomczak