PHP code example of reinfi / zf-dependency-injection
1. Go to this page and download the library: Download reinfi/zf-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/ */
use Reinfi\DependencyInjection\Annotation\Inject;
/**
* @Inject("Namespace\MyService")
*/
private MyService $service;
/**
* @param MyService $service
*/
public function __construct(
MyService $service,
) {
$this->service = $service;
}
use Reinfi\DependencyInjection\Annotation\Inject;
/**
* @Inject("Namespace\MyService")
*/
public function __construct(MyService $service)
{
$this->service = $service;
}