|Ratings|| ||Unique User Downloads|| ||Download Rankings|
|Not enough user ratings||Total: 82 ||All time: 9,882 This week: 228|
This class can create class objects and others that it needs.
It uses reflection to retrieve the information about a class and the parameters that it may need to pass on the constructor function.
If the constructor of the object to be created also needs objects of other classes, this class can also create objects of those other classes and pass them to the current object constructor.
The class may also pass values to the constructor of other types that were previous defined.
This is a simple Dependency Resolver to resolve classes dependencies and instantiate
Install the latest version with:
$ composer require cviniciussdias/dependency-resolver
// Classes definitions
public function __construct(Class2 $class, Class3 $class3)
$this->class2 = $class;
public function test()
public function __construct(Class3 $test, $param = 'default value')
echo $param . PHP_EOL;
public function __toString()
public function __construct($paramWithoutDefaulValue)
public function method()
return 'Class3::method()' . PHP_EOL;
// Resolver usage
$resolver = new Resolver();
$resolver->setParameters(Class3::class, ['paramWithoutDefaulValue' => 'manual value']);
$class1 = $resolver->resolve(Class1::class);
Vinicius Dias - firstname.lastname@example.org - https://github.com/CViniciusSDias/
This component is licensed under the GPL License
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.