interface Application implements Container (View source)

Methods

bool
bound(string $abstract)

Determine if the given abstract type has been bound.

void
alias(string $abstract, string $alias)

Alias a type to a different name.

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

Assign a set of tags to a given binding.

iterable
tagged(string $tag)

Resolve all of the bindings for a given tag.

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

Register a binding with the container.

void
bindMethod(array|string $method, Closure $callback)

Bind a callback to resolve with Container::call.

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

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

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

Register a shared binding in the container.

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

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

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

Register a scoped binding in the container.

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

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

void
extend(string $abstract, Closure $closure)

"Extend" an abstract type in the container.

mixed
instance(string $abstract, mixed $instance)

Register an existing instance as shared in the container.

void
addContextualBinding(string $concrete, string $abstract, Closure|string $implementation)

Add a contextual binding to the container.

when(string|array $concrete)

Define a contextual binding.

factory(string $abstract)

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

void
flush()

Flush the container of all bindings and resolved instances.

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

Resolve the given type from the container.

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

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

bool
resolved(string $abstract)

Determine if the given abstract type has been resolved.

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

Register a new before resolving callback.

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

Register a new resolving callback.

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

Register a new after resolving callback.

string
version()

Get the version number of the application.

string
basePath(string $path = '')

Get the base path of the Laravel installation.

string
bootstrapPath(string $path = '')

Get the path to the bootstrap directory.

string
configPath(string $path = '')

Get the path to the application configuration files.

string
databasePath(string $path = '')

Get the path to the database directory.

string
langPath(string $path = '')

Get the path to the language files.

string
publicPath(string $path = '')

Get the path to the public directory.

string
resourcePath(string $path = '')

Get the path to the resources directory.

string
storagePath(string $path = '')

Get the path to the storage directory.

string|bool
environment(string|array ...$environments)

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
hasDebugModeEnabled()

Determine if the application is running with debug mode enabled.

maintenanceMode()

Get an instance of the maintenance mode manager implementation.

bool
isDownForMaintenance()

Determine if the application is currently down for maintenance.

void
registerConfiguredProviders()

Register all of the configured providers.

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.

resolveProvider(string $provider)

Resolve a service provider instance from the class name.

void
boot()

Boot the application's service providers.

void
booting(callable $callback)

Register a new boot listener.

void
booted(callable $callback)

Register a new "booted" listener.

void
bootstrapWith(array $bootstrappers)

Run the given array of bootstrap classes.

string
getLocale()

Get the current application locale.

string
getNamespace()

Get the application namespace.

array
getProviders(ServiceProvider|string $provider)

Get the registered service provider instances if any exist.

bool
hasBeenBootstrapped()

Determine if the application has been bootstrapped before.

void
loadDeferredProviders()

Load and boot all of the remaining deferred providers.

void
setLocale(string $locale)

Set the current application locale.

bool
shouldSkipMiddleware()

Determine if middleware has been disabled for the application.

terminating(callable|string $callback)

Register a terminating callback with the application.

void
terminate()

Terminate the application.

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

Exceptions

LogicException

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

iterable tagged(string $tag)

Resolve all of the bindings for a given tag.

Parameters

string $tag

Return Value

iterable

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 bindMethod(array|string $method, Closure $callback)

Bind a callback to resolve with Container::call.

Parameters

array|string $method
Closure $callback

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 singletonIf(string $abstract, Closure|string|null $concrete = null)

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

Parameters

string $abstract
Closure|string|null $concrete

Return Value

void

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

Register a scoped binding in the container.

Parameters

string $abstract
Closure|string|null $concrete

Return Value

void

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

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

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

void addContextualBinding(string $concrete, string $abstract, Closure|string $implementation)

Add a contextual binding to the container.

Parameters

string $concrete
string $abstract
Closure|string $implementation

Return Value

void

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

void flush()

Flush the container of all bindings and resolved instances.

Return Value

void

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

Resolve the given type from the container.

Parameters

string $abstract
array $parameters

Return Value

mixed

Exceptions

BindingResolutionException

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 beforeResolving(Closure|string $abstract, Closure|null $callback = null)

Register a new before resolving callback.

Parameters

Closure|string $abstract
Closure|null $callback

Return Value

void

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

Register a new resolving callback.

Parameters

Closure|string $abstract
Closure|null $callback

Return Value

void

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

Register a new after resolving callback.

Parameters

Closure|string $abstract
Closure|null $callback

Return Value

void

string version()

Get the version number of the application.

Return Value

string

string basePath(string $path = '')

Get the base path of the Laravel installation.

Parameters

string $path

Return Value

string

string bootstrapPath(string $path = '')

Get the path to the bootstrap directory.

Parameters

string $path

Return Value

string

string configPath(string $path = '')

Get the path to the application configuration files.

Parameters

string $path

Return Value

string

string databasePath(string $path = '')

Get the path to the database directory.

Parameters

string $path

Return Value

string

string langPath(string $path = '')

Get the path to the language files.

Parameters

string $path

Return Value

string

string publicPath(string $path = '')

Get the path to the public directory.

Parameters

string $path

Return Value

string

string resourcePath(string $path = '')

Get the path to the resources directory.

Parameters

string $path

Return Value

string

string storagePath(string $path = '')

Get the path to the storage directory.

Parameters

string $path

Return Value

string

string|bool environment(string|array ...$environments)

Get or check the current application environment.

Parameters

string|array ...$environments

Return Value

string|bool

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 hasDebugModeEnabled()

Determine if the application is running with debug mode enabled.

Return Value

bool

MaintenanceMode maintenanceMode()

Get an instance of the maintenance mode manager implementation.

Return Value

MaintenanceMode

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

ServiceProvider resolveProvider(string $provider)

Resolve a service provider instance from the class name.

Parameters

string $provider

Return Value

ServiceProvider

void boot()

Boot the application's service providers.

Return Value

void

void booting(callable $callback)

Register a new boot listener.

Parameters

callable $callback

Return Value

void

void booted(callable $callback)

Register a new "booted" listener.

Parameters

callable $callback

Return Value

void

void bootstrapWith(array $bootstrappers)

Run the given array of bootstrap classes.

Parameters

array $bootstrappers

Return Value

void

string getLocale()

Get the current application locale.

Return Value

string

string getNamespace()

Get the application namespace.

Return Value

string

Exceptions

RuntimeException

array getProviders(ServiceProvider|string $provider)

Get the registered service provider instances if any exist.

Parameters

ServiceProvider|string $provider

Return Value

array

bool hasBeenBootstrapped()

Determine if the application has been bootstrapped before.

Return Value

bool

void loadDeferredProviders()

Load and boot all of the remaining deferred providers.

Return Value

void

void setLocale(string $locale)

Set the current application locale.

Parameters

string $locale

Return Value

void

bool shouldSkipMiddleware()

Determine if middleware has been disabled for the application.

Return Value

bool

Application terminating(callable|string $callback)

Register a terminating callback with the application.

Parameters

callable|string $callback

Return Value

Application

void terminate()

Terminate the application.

Return Value

void