PHP code example of quetzal / dependency-injection
1. Go to this page and download the library: Download quetzal/dependency-injection library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
quetzal / dependency-injection example snippets
$container->set('service', function() {
return new stdClass();
});
class Profiler implements IProfiler
{
private $dep1;
private $dep2;
private $dep3;
public function __construct(
ProfilerDependencyA $dep1,
ProfilerDependencyB $dep2,
ProfilerDependencyC $dep3
)
{
$this->dep1 = $dep1;
$this->dep2 = $dep2;
$this->dep3 = $dep3;
}
public function dump()
{
// TODO: Implement dump() method.
}
}