Application

interface Application implements Container (View source)

Methods

bool bound(string $abstract)

Determine if the given abstract type has been bound.

from Container
void alias(string $abstract, string $alias)

Alias a type to a different name.

from Container
void tag(array|string $abstracts, array|mixed $tags)

Assign a set of tags to a given binding.

from Container
array tagged(string $tag)

Resolve all of the bindings for a given tag.

from Container
void bind(string $abstract, Closure|string|null $concrete = null, bool $shared = false)

Register a binding with the container.

from Container
void bindIf(string $abstract, Closure|string|null $concrete = null, bool $shared = false)

Register a binding if it hasn't already been registered.

from Container
void singleton(string $abstract, Closure|string|null $concrete = null)

Register a shared binding in the container.

from Container
void extend(string $abstract, Closure $closure)

"Extend" an abstract type in the container.

from Container
mixed instance(string $abstract, mixed $instance)

Register an existing instance as shared in the container.

from Container
ContextualBindingBuilder when(string|array $concrete)

Define a contextual binding.

from Container
Closure factory(string $abstract)

Get a closure to resolve the given type from the container.

from Container
mixed make(string $abstract, array $parameters = [])

Resolve the given type from the container.

from Container
mixed call(callable|string $callback, array $parameters = [], string|null $defaultMethod = null)

Call the given Closure / class@method and inject its dependencies.

from Container
bool resolved(string $abstract)

Determine if the given abstract type has been resolved.

from Container
void resolving(Closure|string $abstract, Closure $callback = null)

Register a new resolving callback.

from Container
void afterResolving(Closure|string $abstract, Closure $callback = null)

Register a new after resolving callback.

from Container
string version()

Get the version number of the application.

string basePath()

Get the base path of the Laravel installation.

string environment()

Get or check the current application environment.

bool runningInConsole()

Determine if the application is running in the console.

bool runningUnitTests()

Determine if the application is running unit tests.

bool isDownForMaintenance()

Determine if the application is currently down for maintenance.

void registerConfiguredProviders()

Register all of the configured providers.

ServiceProvider register(ServiceProvider|string $provider, bool $force = false)

Register a service provider with the application.

void registerDeferredProvider(string $provider, string|null $service = null)

Register a deferred provider and service.

void boot()

Boot the application's service providers.

void booting(mixed $callback)

Register a new boot listener.

void booted(mixed $callback)

Register a new "booted" listener.

string getCachedServicesPath()

Get the path to the cached services.php file.

string getCachedPackagesPath()

Get the path to the cached packages.php file.

Details

bool bound(string $abstract)

Determine if the given abstract type has been bound.

Parameters

string $abstract

Return Value

bool

void alias(string $abstract, string $alias)

Alias a type to a different name.

Parameters

string $abstract
string $alias

Return Value

void

void tag(array|string $abstracts, array|mixed $tags)

Assign a set of tags to a given binding.

Parameters

array|string $abstracts
array|mixed $tags

Return Value

void

array tagged(string $tag)

Resolve all of the bindings for a given tag.

Parameters

string $tag

Return Value

array

void bind(string $abstract, Closure|string|null $concrete = null, bool $shared = false)

Register a binding with the container.

Parameters

string $abstract
Closure|string|null $concrete
bool $shared

Return Value

void

void bindIf(string $abstract, Closure|string|null $concrete = null, bool $shared = false)

Register a binding if it hasn't already been registered.

Parameters

string $abstract
Closure|string|null $concrete
bool $shared

Return Value

void

void singleton(string $abstract, Closure|string|null $concrete = null)

Register a shared binding in the container.

Parameters

string $abstract
Closure|string|null $concrete

Return Value

void

void extend(string $abstract, Closure $closure)

"Extend" an abstract type in the container.

Parameters

string $abstract
Closure $closure

Return Value

void

Exceptions

InvalidArgumentException

mixed instance(string $abstract, mixed $instance)

Register an existing instance as shared in the container.

Parameters

string $abstract
mixed $instance

Return Value

mixed

ContextualBindingBuilder when(string|array $concrete)

Define a contextual binding.

Parameters

string|array $concrete

Return Value

ContextualBindingBuilder

Closure factory(string $abstract)

Get a closure to resolve the given type from the container.

Parameters

string $abstract

Return Value

Closure

mixed make(string $abstract, array $parameters = [])

Resolve the given type from the container.

Parameters

string $abstract
array $parameters

Return Value

mixed

mixed call(callable|string $callback, array $parameters = [], string|null $defaultMethod = null)

Call the given Closure / class@method and inject its dependencies.

Parameters

callable|string $callback
array $parameters
string|null $defaultMethod

Return Value

mixed

bool resolved(string $abstract)

Determine if the given abstract type has been resolved.

Parameters

string $abstract

Return Value

bool

void resolving(Closure|string $abstract, Closure $callback = null)

Register a new resolving callback.

Parameters

Closure|string $abstract
Closure $callback

Return Value

void

void afterResolving(Closure|string $abstract, Closure $callback = null)

Register a new after resolving callback.

Parameters

Closure|string $abstract
Closure $callback

Return Value

void

string version()

Get the version number of the application.

Return Value

string

string basePath()

Get the base path of the Laravel installation.

Return Value

string

string environment()

Get or check the current application environment.

Return Value

string

bool runningInConsole()

Determine if the application is running in the console.

Return Value

bool

bool runningUnitTests()

Determine if the application is running unit tests.

Return Value

bool

bool isDownForMaintenance()

Determine if the application is currently down for maintenance.

Return Value

bool

void registerConfiguredProviders()

Register all of the configured providers.

Return Value

void

ServiceProvider register(ServiceProvider|string $provider, bool $force = false)

Register a service provider with the application.

Parameters

ServiceProvider|string $provider
bool $force

Return Value

ServiceProvider

void registerDeferredProvider(string $provider, string|null $service = null)

Register a deferred provider and service.

Parameters

string $provider
string|null $service

Return Value

void

void boot()

Boot the application's service providers.

Return Value

void

void booting(mixed $callback)

Register a new boot listener.

Parameters

mixed $callback

Return Value

void

void booted(mixed $callback)

Register a new "booted" listener.

Parameters

mixed $callback

Return Value

void

string getCachedServicesPath()

Get the path to the cached services.php file.

Return Value

string

string getCachedPackagesPath()

Get the path to the cached packages.php file.

Return Value

string

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.7/Illuminate/Contracts/Foundation/Application.html