Simple small PHP dependency injection container
composer require ghosty/container
Register a binding with the container.
use Ghosty\Container\Container;
Container::getInstance()->bind(TestContract::class, Test::class);
Register a singleton binding with the container.
use Ghosty\Container\Container;
Container::getInstance()->singleton(TestContract::class, Test::class);
or
use Ghosty\Container\Container;
Container::getInstance()->bind(TestContract::class, Test::class, true);
Resolve the binding from the container.
use Ghosty\Container\Container;
Container::getInstance()->make(TestContract::class);
Сhecks if the container contains a binding
use Ghosty\Container\Container;
Container::getInstance()->has(TestContract::class);
You can also use facades. For example:
use Ghosty\Container\Facades\Container;
Container::bind(TestContract::class, Test::class);
or
use Ghosty\Container\Facades\Container;
Container::make(TestContract::class);