amphp / injector

A recursive dependency injector used to bootstrap and wire together S.O.L.I.D., object-oriented PHP applications.
MIT License
31 stars 7 forks source link

Aliases #18

Open djones8520 opened 2 years ago

djones8520 commented 2 years ago

I'm updating to php 8.1 and am trying to update auryn with this package. It looks like the readme of this package is a copy and hasn't been updated yet. I've been able to create an object, but I'm not seeing a way to configure aliases. Has that been implemented yet and if so, how do I set aliases?

Here is what I have so far without aliases.

use Amp\Injector\Application;
use Amp\Injector\Injector;
use function Amp\Injector\automaticTypes;
use function Amp\Injector\definitions;
use function Amp\Injector\object;

$definitions = definitions();
$injector = new Injector(automaticTypes($definitions);
$application = new Application($injector, $definitions);

$object = $application->invoke(object("ClassName"));