Application

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

Constants

VERSION

The Laravel framework version.

Properties

static protected Container $instance The current globally available container (if any). from Container
protected array $resolved An array of the types that have been resolved. from Container
protected array $bindings The container's bindings. from Container
protected array $methodBindings The container's method bindings. from Container
protected array $instances The container's shared instances. from Container
protected array $aliases The registered type aliases. from Container
protected array $abstractAliases The registered aliases keyed by the abstract name. from Container
protected array $extenders The extension closures for services. from Container
protected array $tags All of the registered tags. from Container
protected array $buildStack The stack of concretions currently being built. from Container
protected array $with The parameter override stack. from Container
array $contextual The contextual binding map. from Container
protected array $reboundCallbacks All of the registered rebound callbacks. from Container
protected array $globalResolvingCallbacks All of the global resolving callbacks. from Container
protected array $globalAfterResolvingCallbacks All of the global after resolving callbacks. from Container
protected array $resolvingCallbacks All of the resolving callbacks by class type. from Container
protected array $afterResolvingCallbacks All of the after resolving callbacks by class type. from Container
protected string $basePath The base path for the Laravel installation.
protected bool $hasBeenBootstrapped Indicates if the application has been bootstrapped before.
protected bool $booted Indicates if the application has "booted".
protected array $bootingCallbacks The array of booting callbacks.
protected array $bootedCallbacks The array of booted callbacks.
protected array $terminatingCallbacks The array of terminating callbacks.
protected array $serviceProviders All of the registered service providers.
protected array $loadedProviders The names of the loaded service providers.
protected array $deferredServices The deferred services and their providers.
protected string $databasePath The custom database path defined by the developer.
protected string $storagePath The custom storage path defined by the developer.
protected string $environmentPath The custom environment path defined by the developer.
protected string $environmentFile The environment file to load during bootstrapping.
protected string $namespace The application namespace.

Methods

ContextualBindingBuilder when(string|array $concrete)

Define a contextual binding.

from Container
bool bound(string $abstract)

Determine if the given abstract type has been bound.

has($id)

{@inheritdoc}

from Container
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 $abstract, Closure|string|null $concrete = null, bool $shared = false)

Register a binding with the container.

from Container
Closure getClosure(string $abstract, string $concrete)

Get the Closure to be used when building a type.

from Container
bool hasMethodBinding(string $method)

Determine if the container has a method binding.

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

Bind a callback to resolve with Container::call.

from Container
string parseBindMethod(array|string $method)

Get the method to be bound in class@method format.

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 $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
void removeAbstractAlias(string $searched)

Remove an alias from the contextual binding alias cache.

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 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
void rebound(string $abstract)

Fire the "rebound" callbacks for the given abstract type.

from Container
array getReboundCallbacks(string $abstract)

Get the rebound callbacks for a given type.

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

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

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
Closure factory(string $abstract)

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

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

An alias function name for make().

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

Resolve the given type from the container.

get($id)

{@inheritdoc}

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

Resolve the given type from the container.

from Container
mixed getConcrete(string $abstract)

Get the concrete type for a given abstract.

from Container
string|null getContextualConcrete(string $abstract)

Get the contextual concrete binding for the given abstract.

from Container
string|null findInContextualBindings(string $abstract)

Find the concrete binding for the given abstract in the contextual binding array.

from Container
bool isBuildable(mixed $concrete, string $abstract)

Determine if the given concrete is buildable.

from Container
mixed build(string $concrete)

Instantiate a concrete instance of the given type.

from Container
array resolveDependencies(array $dependencies)

Resolve all of the dependencies from the ReflectionParameters.

from Container
bool hasParameterOverride(ReflectionParameter $dependency)

Determine if the given dependency has a parameter override.

from Container
mixed getParameterOverride(ReflectionParameter $dependency)

Get a parameter override for a dependency.

from Container
array getLastParameterOverride()

Get the last parameter override.

from Container
mixed resolvePrimitive(ReflectionParameter $parameter)

Resolve a non-class hinted primitive dependency.

from Container
mixed resolveClass(ReflectionParameter $parameter)

Resolve a class based dependency from the container.

from Container
void notInstantiable(string $concrete)

Throw an exception that the concrete is not instantiable.

from Container
void unresolvablePrimitive(ReflectionParameter $parameter)

Throw an exception for an unresolvable primitive.

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 for all types.

from Container
void fireResolvingCallbacks(string $abstract, mixed $object)

Fire all of the resolving callbacks.

from Container
void fireAfterResolvingCallbacks(string $abstract, mixed $object)

Fire all of the after resolving callbacks.

from Container
array getCallbacksForType(string $abstract, object $object, array $callbacksPerType)

Get all callbacks for a given type.

from Container
void fireCallbackArray(mixed $object, array $callbacks)

Fire an array of callbacks with an object.

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
array getExtenders(string $abstract)

Get the extender callbacks for a given type.

from Container
void forgetExtenders(string $abstract)

Remove all of the extender callbacks for a given type.

from Container
void dropStaleInstances(string $abstract)

Drop all of the stale instances and aliases.

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

Register the basic bindings into the container.

void registerBaseServiceProviders()

Register all of the base service providers.

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.

void bindPathsInContainer()

Bind all of the application paths in the container.

string path(string $path = '')

Get the path to the application "app" directory.

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.

$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(string $path = '')

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 the application is running in the console.

bool runningUnitTests()

Determine if the application is running unit tests.

void registerConfiguredProviders()

Register all of the configured providers.

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

Register a service provider with the application.

ServiceProvider|null getProvider(ServiceProvider|string $provider)

Get the registered service provider instance if it exists.

array getProviders(ServiceProvider|string $provider)

Get the registered service provider instances if any exist.

ServiceProvider resolveProvider(string $provider)

Resolve a service provider instance from the class name.

void markAsRegistered(ServiceProvider $provider)

Mark the given provider as registered.

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|null $service = null)

Register a deferred provider and service.

bool isBooted()

Determine if the application has booted.

void boot()

Boot the application's service providers.

mixed bootProvider(ServiceProvider $provider)

Boot the given service provider.

void booting(mixed $callback)

Register a new boot listener.

void booted(mixed $callback)

Register a new "booted" listener.

void fireAppCallbacks(array $callbacks)

Call the booting callbacks for the application.

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

{@inheritdoc}

bool shouldSkipMiddleware()

Determine if middleware has been disabled for the application.

string getCachedServicesPath()

Get the path to the cached services.php file.

string getCachedPackagesPath()

Get the path to the cached packages.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 = [])

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.

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

ContextualBindingBuilder when(string|array $concrete)

Define a contextual binding.

Parameters

string|array $concrete

Return Value

ContextualBindingBuilder

bool bound(string $abstract)

Determine if the given abstract type has been bound.

(Overriding Container::bound)

Parameters

string $abstract

Return Value

bool

has($id)

{@inheritdoc}

Parameters

$id

bool resolved(string $abstract)

Determine if the given abstract type has been resolved.

Parameters

string $abstract

Return Value

bool

bool isShared(string $abstract)

Determine if a given type is shared.

Parameters

string $abstract

Return Value

bool

bool isAlias(string $name)

Determine if a given string is an alias.

Parameters

string $name

Return Value

bool

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

protected Closure getClosure(string $abstract, string $concrete)

Get the Closure to be used when building a type.

Parameters

string $abstract
string $concrete

Return Value

Closure

bool hasMethodBinding(string $method)

Determine if the container has a method binding.

Parameters

string $method

Return Value

bool

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

Bind a callback to resolve with Container::call.

Parameters

array|string $method
Closure $callback

Return Value

void

protected string parseBindMethod(array|string $method)

Get the method to be bound in class@method format.

Parameters

array|string $method

Return Value

string

mixed callMethodBinding(string $method, mixed $instance)

Get the method binding for the given method.

Parameters

string $method
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

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

protected void removeAbstractAlias(string $searched)

Remove an alias from the contextual binding alias cache.

Parameters

string $searched

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 alias(string $abstract, string $alias)

Alias a type to a different name.

Parameters

string $abstract
string $alias

Return Value

void

mixed rebinding(string $abstract, Closure $callback)

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

Parameters

string $abstract
Closure $callback

Return Value

mixed

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

protected void rebound(string $abstract)

Fire the "rebound" callbacks for the given abstract type.

Parameters

string $abstract

Return Value

void

protected array getReboundCallbacks(string $abstract)

Get the rebound callbacks for a given type.

Parameters

string $abstract

Return Value

array

Closure wrap(Closure $callback, array $parameters = [])

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

Parameters

Closure $callback
array $parameters

Return Value

Closure

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

Closure factory(string $abstract)

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

Parameters

string $abstract

Return Value

Closure

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

An alias function name for make().

Parameters

string $abstract
array $parameters

Return Value

mixed

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

Resolve the given type from the container.

(Overriding Container::make)

Parameters

string $abstract
array $parameters

Return Value

mixed

get($id)

{@inheritdoc}

Parameters

$id

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

Resolve the given type from the container.

Parameters

string $abstract
array $parameters

Return Value

mixed

protected mixed getConcrete(string $abstract)

Get the concrete type for a given abstract.

Parameters

string $abstract

Return Value

mixed $concrete

protected string|null getContextualConcrete(string $abstract)

Get the contextual concrete binding for the given abstract.

Parameters

string $abstract

Return Value

string|null

protected string|null findInContextualBindings(string $abstract)

Find the concrete binding for the given abstract in the contextual binding array.

Parameters

string $abstract

Return Value

string|null

protected bool isBuildable(mixed $concrete, string $abstract)

Determine if the given concrete is buildable.

Parameters

mixed $concrete
string $abstract

Return Value

bool

mixed build(string $concrete)

Instantiate a concrete instance of the given type.

Parameters

string $concrete

Return Value

mixed

Exceptions

BindingResolutionException

protected array resolveDependencies(array $dependencies)

Resolve all of the dependencies from the ReflectionParameters.

Parameters

array $dependencies

Return Value

array

protected bool hasParameterOverride(ReflectionParameter $dependency)

Determine if the given dependency has a parameter override.

Parameters

ReflectionParameter $dependency

Return Value

bool

protected mixed getParameterOverride(ReflectionParameter $dependency)

Get a parameter override for a dependency.

Parameters

ReflectionParameter $dependency

Return Value

mixed

protected array getLastParameterOverride()

Get the last parameter override.

Return Value

array

protected mixed resolvePrimitive(ReflectionParameter $parameter)

Resolve a non-class hinted primitive dependency.

Parameters

ReflectionParameter $parameter

Return Value

mixed

Exceptions

BindingResolutionException

protected mixed resolveClass(ReflectionParameter $parameter)

Resolve a class based dependency from the container.

Parameters

ReflectionParameter $parameter

Return Value

mixed

Exceptions

BindingResolutionException

protected void notInstantiable(string $concrete)

Throw an exception that the concrete is not instantiable.

Parameters

string $concrete

Return Value

void

Exceptions

BindingResolutionException

protected void unresolvablePrimitive(ReflectionParameter $parameter)

Throw an exception for an unresolvable primitive.

Parameters

ReflectionParameter $parameter

Return Value

void

Exceptions

BindingResolutionException

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 for all types.

Parameters

Closure|string $abstract
Closure $callback

Return Value

void

protected void fireResolvingCallbacks(string $abstract, mixed $object)

Fire all of the resolving callbacks.

Parameters

string $abstract
mixed $object

Return Value

void

protected void fireAfterResolvingCallbacks(string $abstract, mixed $object)

Fire all of the after resolving callbacks.

Parameters

string $abstract
mixed $object

Return Value

void

protected array getCallbacksForType(string $abstract, object $object, array $callbacksPerType)

Get all callbacks for a given type.

Parameters

string $abstract
object $object
array $callbacksPerType

Return Value

array

protected void fireCallbackArray(mixed $object, array $callbacks)

Fire an array of callbacks with an object.

Parameters

mixed $object
array $callbacks

Return Value

void

array getBindings()

Get the container's bindings.

Return Value

array

string getAlias(string $abstract)

Get the alias for an abstract if available.

Parameters

string $abstract

Return Value

string

Exceptions

LogicException

protected array getExtenders(string $abstract)

Get the extender callbacks for a given type.

Parameters

string $abstract

Return Value

array

void forgetExtenders(string $abstract)

Remove all of the extender callbacks for a given type.

Parameters

string $abstract

Return Value

void

protected void dropStaleInstances(string $abstract)

Drop all of the stale instances and aliases.

Parameters

string $abstract

Return Value

void

void forgetInstance(string $abstract)

Remove a resolved instance from the instance cache.

Parameters

string $abstract

Return Value

void

void forgetInstances()

Clear all of the instances from the container.

Return Value

void

void flush()

Flush the container of all bindings and resolved instances.

Return Value

void

static Container getInstance()

Set the globally available instance of the container.

Return Value

Container

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

Set the shared instance of the container.

Parameters

Container $container

Return Value

Container|Container

bool offsetExists(string $key)

Determine if a given offset exists.

Parameters

string $key

Return Value

bool

mixed offsetGet(string $key)

Get the value at a given offset.

Parameters

string $key

Return Value

mixed

void offsetSet(string $key, mixed $value)

Set the value at a given offset.

Parameters

string $key
mixed $value

Return Value

void

void offsetUnset(string $key)

Unset the value at a given offset.

Parameters

string $key

Return Value

void

mixed __get(string $key)

Dynamically access container services.

Parameters

string $key

Return Value

mixed

void __set(string $key, mixed $value)

Dynamically set container services.

Parameters

string $key
mixed $value

Return Value

void

void __construct(string|null $basePath = null)

Create a new Illuminate application instance.

Parameters

string|null $basePath

Return Value

void

string version()

Get the version number of the application.

Return Value

string

protected void registerBaseBindings()

Register the basic bindings into the container.

Return Value

void

protected void registerBaseServiceProviders()

Register all of the base service providers.

Return Value

void

void bootstrapWith(array $bootstrappers)

Run the given array of bootstrap classes.

Parameters

array $bootstrappers

Return Value

void

void afterLoadingEnvironment(Closure $callback)

Register a callback to run after loading the environment.

Parameters

Closure $callback

Return Value

void

void beforeBootstrapping(string $bootstrapper, Closure $callback)

Register a callback to run before a bootstrapper.

Parameters

string $bootstrapper
Closure $callback

Return Value

void

void afterBootstrapping(string $bootstrapper, Closure $callback)

Register a callback to run after a bootstrapper.

Parameters

string $bootstrapper
Closure $callback

Return Value

void

bool hasBeenBootstrapped()

Determine if the application has been bootstrapped before.

Return Value

bool

$this setBasePath(string $basePath)

Set the base path for the application.

Parameters

string $basePath

Return Value

$this

protected void bindPathsInContainer()

Bind all of the application paths in the container.

Return Value

void

string path(string $path = '')

Get the path to the application "app" directory.

Parameters

string $path Optionally, a path to append to the app path

Return Value

string

string basePath(string $path = '')

Get the base path of the Laravel installation.

Parameters

string $path Optionally, a path to append to the base path

Return Value

string

string bootstrapPath(string $path = '')

Get the path to the bootstrap directory.

Parameters

string $path Optionally, a path to append to the bootstrap path

Return Value

string

string configPath(string $path = '')

Get the path to the application configuration files.

Parameters

string $path Optionally, a path to append to the config path

Return Value

string

string databasePath(string $path = '')

Get the path to the database directory.

Parameters

string $path Optionally, a path to append to the database path

Return Value

string

$this useDatabasePath(string $path)

Set the database directory.

Parameters

string $path

Return Value

$this

string langPath()

Get the path to the language files.

Return Value

string

string publicPath()

Get the path to the public / web directory.

Return Value

string

string storagePath()

Get the path to the storage directory.

Return Value

string

$this useStoragePath(string $path)

Set the storage directory.

Parameters

string $path

Return Value

$this

string resourcePath(string $path = '')

Get the path to the resources directory.

Parameters

string $path

Return Value

string

string environmentPath()

Get the path to the environment file directory.

Return Value

string

$this useEnvironmentPath(string $path)

Set the directory for the environment file.

Parameters

string $path

Return Value

$this

$this loadEnvironmentFrom(string $file)

Set the environment file to be loaded during bootstrapping.

Parameters

string $file

Return Value

$this

string environmentFile()

Get the environment file the application is using.

Return Value

string

string environmentFilePath()

Get the fully qualified path to the environment file.

Return Value

string

string environment()

Get or check the current application environment.

Return Value

string

bool isLocal()

Determine if application is in local environment.

Return Value

bool

string detectEnvironment(Closure $callback)

Detect the application's current environment.

Parameters

Closure $callback

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

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

ServiceProvider|null getProvider(ServiceProvider|string $provider)

Get the registered service provider instance if it exists.

Parameters

ServiceProvider|string $provider

Return Value

ServiceProvider|null

array getProviders(ServiceProvider|string $provider)

Get the registered service provider instances if any exist.

Parameters

ServiceProvider|string $provider

Return Value

array

ServiceProvider resolveProvider(string $provider)

Resolve a service provider instance from the class name.

Parameters

string $provider

Return Value

ServiceProvider

protected void markAsRegistered(ServiceProvider $provider)

Mark the given provider as registered.

Parameters

ServiceProvider $provider

Return Value

void

void loadDeferredProviders()

Load and boot all of the remaining deferred providers.

Return Value

void

void loadDeferredProvider(string $service)

Load the provider for a deferred service.

Parameters

string $service

Return Value

void

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

Register a deferred provider and service.

Parameters

string $provider
string|null $service

Return Value

void

bool isBooted()

Determine if the application has booted.

Return Value

bool

void boot()

Boot the application's service providers.

Return Value

void

protected mixed bootProvider(ServiceProvider $provider)

Boot the given service provider.

Parameters

ServiceProvider $provider

Return Value

mixed

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

protected void fireAppCallbacks(array $callbacks)

Call the booting callbacks for the application.

Parameters

array $callbacks

Return Value

void

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

{@inheritdoc}

Parameters

Request $request
$type
$catch

bool shouldSkipMiddleware()

Determine if middleware has been disabled for the application.

Return Value

bool

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

bool configurationIsCached()

Determine if the application configuration is cached.

Return Value

bool

string getCachedConfigPath()

Get the path to the configuration cache file.

Return Value

string

bool routesAreCached()

Determine if the application routes are cached.

Return Value

bool

string getCachedRoutesPath()

Get the path to the routes cache file.

Return Value

string

bool isDownForMaintenance()

Determine if the application is currently down for maintenance.

Return Value

bool

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

Throw an HttpException with the given data.

Parameters

int $code
string $message
array $headers

Return Value

void

Exceptions

HttpException

$this terminating(Closure $callback)

Register a terminating callback with the application.

Parameters

Closure $callback

Return Value

$this

void terminate()

Terminate the application.

Return Value

void

array getLoadedProviders()

Get the service providers that have been loaded.

Return Value

array

array getDeferredServices()

Get the application's deferred services.

Return Value

array

void setDeferredServices(array $services)

Set the application's deferred services.

Parameters

array $services

Return Value

void

void addDeferredServices(array $services)

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

Parameters

array $services

Return Value

void

bool isDeferredService(string $service)

Determine if the given service is a deferred service.

Parameters

string $service

Return Value

bool

void provideFacades(string $namespace)

Configure the real-time facade namespace.

Parameters

string $namespace

Return Value

void

string getLocale()

Get the current application locale.

Return Value

string

void setLocale(string $locale)

Set the current application locale.

Parameters

string $locale

Return Value

void

bool isLocale(string $locale)

Determine if application locale is the given locale.

Parameters

string $locale

Return Value

bool

void registerCoreContainerAliases()

Register the core class aliases in the container.

Return Value

void

string getNamespace()

Get the application namespace.

Return Value

string

Exceptions

RuntimeException

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