You are viewing documentation for an outdated version. It is no longer supported!

IoC Service Container

The \Aedart\Container\IoC is a slightly adapted version of Laravel's Service Containeropen in new window. Please make sure to read their documentation, before attempting to use this version.

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 Facadeopen in new window.

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 Facadeopen in new window component, before removing itself.

$container->destroy();

Onward

For additional information, please review the source code of this component.