class Application extends Container implements Application, HttpKernelInterface (View source)

Constants

VERSION

The Laravel framework version.

Properties

array $contextual The contextual binding map. from Container

Methods

when(string $concrete)

Define a contextual binding.

from Container
bool
bound(string $abstract)

Determine if the given abstract type has been bound.

bool
resolved(string $abstract)

Determine if the given abstract type has been resolved.

from Container
bool
isShared(string $abstract)

Determine if a given type is shared.

from Container
bool
isAlias(string $name)

Determine if a given string is an alias.

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

Register a binding with the container.

from Container
bool
hasMethodBinding(string $method)

Determine if the container has a method binding.

from Container
void
bindMethod(string $method, Closure $callback)

Bind a callback to resolve with Container::call.

from Container
mixed
callMethodBinding(string $method, mixed $instance)

Get the method binding for the given method.

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

Add a contextual binding to 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|array $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
void
instance(string $abstract, mixed $instance)

Register an existing instance as shared in the container.

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

Assign a set of tags to a given binding.

from Container
array
tagged(array $tag)

Resolve all of the bindings for a given tag.

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

Alias a type to a different name.

from Container
mixed
rebinding(string $abstract, Closure $callback)

Bind a new callback to an abstract's rebind event.

from Container
mixed
refresh(string $abstract, mixed $target, string $method)

Refresh an instance on the given target and method.

from Container
wrap(Closure $callback, array $parameters = array())

Wrap the given closure such that its dependencies will be injected when executed.

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

Call the given Closure / [email protected] and inject its dependencies.

from Container
factory(string $abstract)

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

from Container
mixed
makeWith(string $abstract, array $parameters)

Resolve the given type with the given parameter overrides.

from Container
mixed
make(string $abstract)

Resolve the given type from the container.

mixed
build(string $concrete)

Instantiate a concrete instance of the given type.

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

Register a new resolving callback.

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

Register a new after resolving callback for all types.

from Container
array
getBindings()

Get the container's bindings.

from Container
string
getAlias(string $abstract)

Get the alias for an abstract if available.

from Container
void
forgetInstance(string $abstract)

Remove a resolved instance from the instance cache.

from Container
void
forgetInstances()

Clear all of the instances from the container.

from Container
void
flush()

Flush the container of all bindings and resolved instances.

static Container
getInstance()

Set the globally available instance of the container.

from Container
static Container
setInstance(Container $container = null)

Set the shared instance of the container.

from Container
bool
offsetExists(string $key)

Determine if a given offset exists.

from Container
mixed
offsetGet(string $key)

Get the value at a given offset.

from Container
void
offsetSet(string $key, mixed $value)

Set the value at a given offset.

from Container
void
offsetUnset(string $key)

Unset the value at a given offset.

from Container
mixed
__get(string $key)

Dynamically access container services.

from Container
void
__set(string $key, mixed $value)

Dynamically set container services.

from Container
void
__construct(string|null $basePath = null)

Create a new Illuminate application instance.

string
version()

Get the version number of the application.

void
bootstrapWith(array $bootstrappers)

Run the given array of bootstrap classes.

void
afterLoadingEnvironment(Closure $callback)

Register a callback to run after loading the environment.

void
beforeBootstrapping(string $bootstrapper, Closure $callback)

Register a callback to run before a bootstrapper.

void
afterBootstrapping(string $bootstrapper, Closure $callback)

Register a callback to run after a bootstrapper.

bool
hasBeenBootstrapped()

Determine if the application has been bootstrapped before.

$this
setBasePath(string $basePath)

Set the base path for the application.

string
path()

Get the path to the application "app" directory.

string
basePath()

Get the base path of the Laravel installation.

string
bootstrapPath()

Get the path to the bootstrap directory.

string
configPath()

Get the path to the application configuration files.

string
databasePath()

Get the path to the database directory.

$this
useDatabasePath(string $path)

Set the database directory.

string
langPath()

Get the path to the language files.

string
publicPath()

Get the path to the public / web directory.

string
storagePath()

Get the path to the storage directory.

$this
useStoragePath(string $path)

Set the storage directory.

string
resourcePath()

Get the path to the resources directory.

string
environmentPath()

Get the path to the environment file directory.

$this
useEnvironmentPath(string $path)

Set the directory for the environment file.

$this
loadEnvironmentFrom(string $file)

Set the environment file to be loaded during bootstrapping.

string
environmentFile()

Get the environment file the application is using.

string
environmentFilePath()

Get the fully qualified path to the environment file.

string
environment()

Get or check the current application environment.

bool
isLocal()

Determine if application is in local environment.

string
detectEnvironment(Closure $callback)

Detect the application's current environment.

bool
runningInConsole()

Determine if we are running in the console.

bool
runningUnitTests()

Determine if we are running unit tests.

void
registerConfiguredProviders()

Register all of the configured providers.

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

Register a service provider with the application.

getProvider(ServiceProvider|string $provider)

Get the registered service provider instance if it exists.

resolveProvider(string $provider)

Resolve a service provider instance from the class name.

void
loadDeferredProviders()

Load and boot all of the remaining deferred providers.

void
loadDeferredProvider(string $service)

Load the provider for a deferred service.

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

Register a deferred provider and service.

bool
isBooted()

Determine if the application has booted.

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.

handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)

[email protected]}

bool
shouldSkipMiddleware()

Determine if middleware has been disabled for the application.

string
getCachedServicesPath()

Get the path to the cached services.php file.

bool
configurationIsCached()

Determine if the application configuration is cached.

string
getCachedConfigPath()

Get the path to the configuration cache file.

bool
routesAreCached()

Determine if the application routes are cached.

string
getCachedRoutesPath()

Get the path to the routes cache file.

bool
isDownForMaintenance()

Determine if the application is currently down for maintenance.

void
abort(int $code, string $message = '', array $headers = array())

Throw an HttpException with the given data.

$this
terminating(Closure $callback)

Register a terminating callback with the application.

void
terminate()

Terminate the application.

array
getLoadedProviders()

Get the service providers that have been loaded.

array
getDeferredServices()

Get the application's deferred services.

void
setDeferredServices(array $services)

Set the application's deferred services.

void
addDeferredServices(array $services)

Add an array of services to the application's deferred services.

bool
isDeferredService(string $service)

Determine if the given service is a deferred service.

void
provideFacades(string $namespace)

Configure the real-time facade namespace.

$this
configureMonologUsing(callable $callback)

Define a callback to be used to configure Monolog.

bool
hasMonologConfigurator()

Determine if the application has a custom Monolog configurator.

callable
getMonologConfigurator()

Get the custom Monolog configurator for the application.

string
getLocale()

Get the current application locale.

void
setLocale(string $locale)

Set the current application locale.

bool
isLocale(string $locale)

Determine if application locale is the given locale.

void
registerCoreContainerAliases()

Register the core class aliases in the container.

string
getNamespace()

Get the application namespace.

Details

in Container at line line 140
ContextualBindingBuilder when(string $concrete)

Define a contextual binding.

Parameters

string $concrete

Return Value

ContextualBindingBuilder

at line line 713
bool bound(string $abstract)

Determine if the given abstract type has been bound.

(Overriding Container::bound)

Parameters

string $abstract

Return Value

bool

in Container at line line 164
bool resolved(string $abstract)

Determine if the given abstract type has been resolved.

Parameters

string $abstract

Return Value

bool

in Container at line line 180
bool isShared(string $abstract)

Determine if a given type is shared.

Parameters

string $abstract

Return Value

bool

in Container at line line 193
bool isAlias(string $name)

Determine if a given string is an alias.

Parameters

string $name

Return Value

bool

in Container at line line 206
void bind(string|array $abstract, Closure|string|null $concrete = null, bool $shared = false)

Register a binding with the container.

Parameters

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

Return Value

void

in Container at line line 256
bool hasMethodBinding(string $method)

Determine if the container has a method binding.

Parameters

string $method

Return Value

bool

in Container at line line 268
void bindMethod(string $method, Closure $callback)

Bind a callback to resolve with Container::call.

Parameters

string $method
Closure $callback

Return Value

void

in Container at line line 280
mixed callMethodBinding(string $method, mixed $instance)

Get the method binding for the given method.

Parameters

string $method
mixed $instance

Return Value

mixed

in Container at line line 293
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

in Container at line line 306
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

in Container at line line 320
void singleton(string|array $abstract, Closure|string|null $concrete = null)

Register a shared binding in the container.

Parameters

string|array $abstract
Closure|string|null $concrete

Return Value

void

in Container at line line 334
void extend(string $abstract, Closure $closure)

"Extend" an abstract type in the container.

Parameters

string $abstract
Closure $closure

Return Value

void

Exceptions

InvalidArgumentException

in Container at line line 354
void instance(string $abstract, mixed $instance)

Register an existing instance as shared in the container.

Parameters

string $abstract
mixed $instance

Return Value

void

in Container at line line 398
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

in Container at line line 419
array tagged(array $tag)

Resolve all of the bindings for a given tag.

Parameters

array $tag

Return Value

array

in Container at line line 439
void alias(string $abstract, string $alias)

Alias a type to a different name.

Parameters

string $abstract
string $alias

Return Value

void

in Container at line line 453
mixed rebinding(string $abstract, Closure $callback)

Bind a new callback to an abstract's rebind event.

Parameters

string $abstract
Closure $callback

Return Value

mixed

in Container at line line 470
mixed refresh(string $abstract, mixed $target, string $method)

Refresh an instance on the given target and method.

Parameters

string $abstract
mixed $target
string $method

Return Value

mixed

in Container at line line 514
Closure wrap(Closure $callback, array $parameters = array())

Wrap the given closure such that its dependencies will be injected when executed.

Parameters

Closure $callback
array $parameters

Return Value

Closure

in Container at line line 529
mixed call(callable|string $callback, array $parameters = array(), string|null $defaultMethod = null)

Call the given Closure / [email protected] and inject its dependencies.

Parameters

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

Return Value

mixed

in Container at line line 540
Closure factory(string $abstract)

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

Parameters

string $abstract

Return Value

Closure

in Container at line line 554
mixed makeWith(string $abstract, array $parameters)

Resolve the given type with the given parameter overrides.

Parameters

string $abstract
array $parameters

Return Value

mixed

at line line 694
mixed make(string $abstract)

Resolve the given type from the container.

(Overriding Container::make)

Parameters

string $abstract

Return Value

mixed

in Container at line line 710
mixed build(string $concrete)

Instantiate a concrete instance of the given type.

Parameters

string $concrete

Return Value

mixed

Exceptions

BindingResolutionException

in Container at line line 898
void resolving(string $abstract, Closure $callback = null)

Register a new resolving callback.

Parameters

string $abstract
Closure $callback

Return Value

void

in Container at line line 918
void afterResolving(string $abstract, Closure $callback = null)

Register a new after resolving callback for all types.

Parameters

string $abstract
Closure $callback

Return Value

void

in Container at line line 1006
array getBindings()

Get the container's bindings.

Return Value

array

in Container at line line 1019
string getAlias(string $abstract)

Get the alias for an abstract if available.

Parameters

string $abstract

Return Value

string

Exceptions

LogicException

in Container at line line 1066
void forgetInstance(string $abstract)

Remove a resolved instance from the instance cache.

Parameters

string $abstract

Return Value

void

in Container at line line 1076
void forgetInstances()

Clear all of the instances from the container.

Return Value

void

at line line 1117
void flush()

Flush the container of all bindings and resolved instances.

Return Value

void

in Container at line line 1100
static Container getInstance()

Set the globally available instance of the container.

Return Value

Container

in Container at line line 1115
static Container setInstance(Container $container = null)

Set the shared instance of the container.

Parameters

Container $container

Return Value

Container

in Container at line line 1126
bool offsetExists(string $key)

Determine if a given offset exists.

Parameters

string $key

Return Value

bool

in Container at line line 1137
mixed offsetGet(string $key)

Get the value at a given offset.

Parameters

string $key

Return Value

mixed

in Container at line line 1149
void offsetSet(string $key, mixed $value)

Set the value at a given offset.

Parameters

string $key
mixed $value

Return Value

void

in Container at line line 1162
void offsetUnset(string $key)

Unset the value at a given offset.

Parameters

string $key

Return Value

void

in Container at line line 1173
mixed __get(string $key)

Dynamically access container services.

Parameters

string $key

Return Value

mixed

in Container at line line 1185
void __set(string $key, mixed $value)

Dynamically set container services.

Parameters

string $key
mixed $value

Return Value

void

at line line 144
void __construct(string|null $basePath = null)

Create a new Illuminate application instance.

Parameters

string|null $basePath

Return Value

void

at line line 162
string version()

Get the version number of the application.

Return Value

string

at line line 201
void bootstrapWith(array $bootstrappers)

Run the given array of bootstrap classes.

Parameters

array $bootstrappers

Return Value

void

at line line 220
void afterLoadingEnvironment(Closure $callback)

Register a callback to run after loading the environment.

Parameters

Closure $callback

Return Value

void

at line line 234
void beforeBootstrapping(string $bootstrapper, Closure $callback)

Register a callback to run before a bootstrapper.

Parameters

string $bootstrapper
Closure $callback

Return Value

void

at line line 246
void afterBootstrapping(string $bootstrapper, Closure $callback)

Register a callback to run after a bootstrapper.

Parameters

string $bootstrapper
Closure $callback

Return Value

void

at line line 256
bool hasBeenBootstrapped()

Determine if the application has been bootstrapped before.

Return Value

bool

at line line 267
$this setBasePath(string $basePath)

Set the base path for the application.

Parameters

string $basePath

Return Value

$this

at line line 299
string path()

Get the path to the application "app" directory.

Return Value

string

at line line 309
string basePath()

Get the base path of the Laravel installation.

Return Value

string

at line line 319
string bootstrapPath()

Get the path to the bootstrap directory.

Return Value

string

at line line 329
string configPath()

Get the path to the application configuration files.

Return Value

string

at line line 339
string databasePath()

Get the path to the database directory.

Return Value

string

at line line 350
$this useDatabasePath(string $path)

Set the database directory.

Parameters

string $path

Return Value

$this

at line line 364
string langPath()

Get the path to the language files.

Return Value

string

at line line 374
string publicPath()

Get the path to the public / web directory.

Return Value

string

at line line 384
string storagePath()

Get the path to the storage directory.

Return Value

string

at line line 395
$this useStoragePath(string $path)

Set the storage directory.

Parameters

string $path

Return Value

$this

at line line 409
string resourcePath()

Get the path to the resources directory.

Return Value

string

at line line 419
string environmentPath()

Get the path to the environment file directory.

Return Value

string

at line line 430
$this useEnvironmentPath(string $path)

Set the directory for the environment file.

Parameters

string $path

Return Value

$this

at line line 443
$this loadEnvironmentFrom(string $file)

Set the environment file to be loaded during bootstrapping.

Parameters

string $file

Return Value

$this

at line line 455
string environmentFile()

Get the environment file the application is using.

Return Value

string

at line line 465
string environmentFilePath()

Get the fully qualified path to the environment file.

Return Value

string

at line line 475
string environment()

Get or check the current application environment.

Return Value

string

at line line 497
bool isLocal()

Determine if application is in local environment.

Return Value

bool

at line line 508
string detectEnvironment(Closure $callback)

Detect the application's current environment.

Parameters

Closure $callback

Return Value

string

at line line 520
bool runningInConsole()

Determine if we are running in the console.

Return Value

bool

at line line 530
bool runningUnitTests()

Determine if we are running unit tests.

Return Value

bool

at line line 540
void registerConfiguredProviders()

Register all of the configured providers.

Return Value

void

at line line 554
ServiceProvider register(ServiceProvider|string $provider, array $options = array(), bool $force = false)

Register a service provider with the application.

Parameters

ServiceProvider|string $provider
array $options
bool $force

Return Value

ServiceProvider

at line line 589
ServiceProvider|null getProvider(ServiceProvider|string $provider)

Get the registered service provider instance if it exists.

Parameters

ServiceProvider|string $provider

Return Value

ServiceProvider|null

at line line 604
ServiceProvider resolveProvider(string $provider)

Resolve a service provider instance from the class name.

Parameters

string $provider

Return Value

ServiceProvider

at line line 627
void loadDeferredProviders()

Load and boot all of the remaining deferred providers.

Return Value

void

at line line 645
void loadDeferredProvider(string $service)

Load the provider for a deferred service.

Parameters

string $service

Return Value

void

at line line 668
void registerDeferredProvider(string $provider, string $service = null)

Register a deferred provider and service.

Parameters

string $provider
string $service

Return Value

void

at line line 723
bool isBooted()

Determine if the application has booted.

Return Value

bool

at line line 733
void boot()

Boot the application's service providers.

Return Value

void

at line line 772
void booting(mixed $callback)

Register a new boot listener.

Parameters

mixed $callback

Return Value

void

at line line 783
void booted(mixed $callback)

Register a new "booted" listener.

Parameters

mixed $callback

Return Value

void

at line line 808
handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)

[email protected]}

Parameters

Request $request
$type
$catch

at line line 818
bool shouldSkipMiddleware()

Determine if middleware has been disabled for the application.

Return Value

bool

at line line 829
string getCachedServicesPath()

Get the path to the cached services.php file.

Return Value

string

at line line 839
bool configurationIsCached()

Determine if the application configuration is cached.

Return Value

bool

at line line 849
string getCachedConfigPath()

Get the path to the configuration cache file.

Return Value

string

at line line 859
bool routesAreCached()

Determine if the application routes are cached.

Return Value

bool

at line line 869
string getCachedRoutesPath()

Get the path to the routes cache file.

Return Value

string

at line line 879
bool isDownForMaintenance()

Determine if the application is currently down for maintenance.

Return Value

bool

at line line 894
void abort(int $code, string $message = '', array $headers = array())

Throw an HttpException with the given data.

Parameters

int $code
string $message
array $headers

Return Value

void

Exceptions

HttpException

at line line 909
$this terminating(Closure $callback)

Register a terminating callback with the application.

Parameters

Closure $callback

Return Value

$this

at line line 921
void terminate()

Terminate the application.

Return Value

void

at line line 933
array getLoadedProviders()

Get the service providers that have been loaded.

Return Value

array

at line line 943
array getDeferredServices()

Get the application's deferred services.

Return Value

array

at line line 954
void setDeferredServices(array $services)

Set the application's deferred services.

Parameters

array $services

Return Value

void

at line line 965
void addDeferredServices(array $services)

Add an array of services to the application's deferred services.

Parameters

array $services

Return Value

void

at line line 976
bool isDeferredService(string $service)

Determine if the given service is a deferred service.

Parameters

string $service

Return Value

bool

at line line 987
void provideFacades(string $namespace)

Configure the real-time facade namespace.

Parameters

string $namespace

Return Value

void

at line line 998
$this configureMonologUsing(callable $callback)

Define a callback to be used to configure Monolog.

Parameters

callable $callback

Return Value

$this

at line line 1010
bool hasMonologConfigurator()

Determine if the application has a custom Monolog configurator.

Return Value

bool

at line line 1020
callable getMonologConfigurator()

Get the custom Monolog configurator for the application.

Return Value

callable

at line line 1030
string getLocale()

Get the current application locale.

Return Value

string

at line line 1041
void setLocale(string $locale)

Set the current application locale.

Parameters

string $locale

Return Value

void

at line line 1056
bool isLocale(string $locale)

Determine if application locale is the given locale.

Parameters

string $locale

Return Value

bool

at line line 1066
void registerCoreContainerAliases()

Register the core class aliases in the container.

Return Value

void

at line line 1131
string getNamespace()

Get the application namespace.

Return Value

string

Exceptions

RuntimeException