1. Go to this page and download the library: Download jeroen-g/autowire 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/ */
namespace App;
use App\Contracts\HelloInterface;
#[Configure(['$message' => 'world'])]
class WorldClass
{
private $message;
public function __construct($message)
{
$this->message = $message;
}
}
// Will get the value set in config/app.php
#[Configure(['$message' => '%app.message%'])]
// Will inject an instance of the Message class
#[Configure(['$message' => '@App\Domain\Message'])]
// When you have multiple constructor arguments
#[Configure(['$message' => '%app.message%', '$logger' => '@Psr\Log\LoggerInterface'])]