IoC Service Container
The \Aedart\Container\IoC
is a slightly adapted version of Laravel's Service Container. Please make sure to read their documentation, before attempting to use this version.
Info
IoC stands for Inversion of control.
getInstance()
Creates or obtains existing Service Container instance. This method registers the IoC
as the app
instance within itself. Furthermore, the method also ensures to set the container as the "application" instance in Laravel's Facade.
These additions have been made to make it easier, when working with Laravel components outside a typical Laravel application.
use Aedart\Container\IoC;
$container = IoC::getInstance();
destroy()
When you destroy the Service Container, the destroy()
method will ensure to clear all resolved instances, within the Facade component, before removing itself.
$container->destroy();
Onward
For additional information, please review the source code of this component.