class Illuminate / Foundation / Application
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

Application

Extends

Implements

Uses

Constants

public

VERSION string

The Laravel framework version.

Default: '11.x-dev'

Properties

protected

$basePath string

The base path for the Laravel installation.

Default: null
protected

$hasBeenBootstrapped bool

Indicates if the application has been bootstrapped before.

Default: false
protected

$booted bool

Indicates if the application has "booted".

Default: false
protected

$bootingCallbacks callable[]

The array of booting callbacks.

Default: []
protected

$bootedCallbacks callable[]

The array of booted callbacks.

Default: []
protected

$terminatingCallbacks callable[]

The array of terminating callbacks.

Default: []
protected

$serviceProviders Illuminate\...\ServiceProvider[]

All of the registered service providers.

Default: []
protected

$loadedProviders array

The names of the loaded service providers.

Default: []
protected

$deferredServices array

The deferred services and their providers.

Default: []
protected

$bootstrapPath string

The custom bootstrap path defined by the developer.

Default: null
protected

$appPath string

The custom application path defined by the developer.

Default: null
protected

$configPath string

The custom configuration path defined by the developer.

Default: null
protected

$databasePath string

The custom database path defined by the developer.

Default: null
protected

$langPath string

The custom language file path defined by the developer.

Default: null
protected

$publicPath string

The custom public / web path defined by the developer.

Default: null
protected

$storagePath string

The custom storage path defined by the developer.

Default: null
protected

$environmentPath string

The custom environment path defined by the developer.

Default: null
protected

$environmentFile string

The environment file to load during bootstrapping.

Default: '.env'
protected

$isRunningInConsole bool|null

Indicates if the application is running in the console.

Default: null
protected

$namespace string

The application namespace.

Default: null
protected

$absoluteCachePathPrefixes string[]

The prefixes of absolute cache paths for use during normalization.

Default: array

Methods

public

__construct ( $basePath ) : void

Create a new Illuminate application instance.

Parameters

  • $basePath string|null
public

version ( ) : string

Get the version number of the application.

protected

registerBaseBindings ( ) : void

Register the basic bindings into the container.

protected

registerBaseServiceProviders ( ) : void

Register all of the base service providers.

public

bootstrapWith ( array $bootstrappers ) : void

Run the given array of bootstrap classes.

Parameters

  • $bootstrappers string[]
public

afterLoadingEnvironment ( Closure $callback ) : void

Register a callback to run after loading the environment.

Parameters

public

beforeBootstrapping ( $bootstrapper , Closure $callback ) : void

Register a callback to run before a bootstrapper.

Parameters

  • $bootstrapper string
  • $callback Closure
public

afterBootstrapping ( $bootstrapper , Closure $callback ) : void

Register a callback to run after a bootstrapper.

Parameters

  • $bootstrapper string
  • $callback Closure
public

hasBeenBootstrapped ( ) : bool

Determine if the application has been bootstrapped before.

public

setBasePath ( $basePath ) : $this

Set the base path for the application.

Parameters

  • $basePath string
protected

bindPathsInContainer ( ) : void

Bind all of the application paths in the container.

public

path ( $path ) : string

Get the path to the application "app" directory.

Parameters

  • $path string
public

useAppPath ( $path ) : $this

Set the application directory.

Parameters

  • $path string
public

basePath ( $path ) : string

Get the base path of the Laravel installation.

Parameters

  • $path string
public

bootstrapPath ( $path ) : string

Get the path to the bootstrap directory.

Parameters

  • $path string
public

useBootstrapPath ( $path ) : $this

Set the bootstrap file directory.

Parameters

  • $path string
public

configPath ( $path ) : string

Get the path to the application configuration files.

Parameters

  • $path string
public

useConfigPath ( $path ) : $this

Set the configuration directory.

Parameters

  • $path string
public

databasePath ( $path ) : string

Get the path to the database directory.

Parameters

  • $path string
public

useDatabasePath ( $path ) : $this

Set the database directory.

Parameters

  • $path string
public

langPath ( $path ) : string

Get the path to the language files.

Parameters

  • $path string
public

useLangPath ( $path ) : $this

Set the language file directory.

Parameters

  • $path string
public

publicPath ( $path ) : string

Get the path to the public / web directory.

Parameters

  • $path string
public

usePublicPath ( $path ) : $this

Set the public / web directory.

Parameters

  • $path string
public

storagePath ( $path ) : string

Get the path to the storage directory.

Parameters

  • $path string
public

useStoragePath ( $path ) : $this

Set the storage directory.

Parameters

  • $path string
public

resourcePath ( $path ) : string

Get the path to the resources directory.

Parameters

  • $path string
public

viewPath ( $path ) : string

Get the path to the views directory.

Parameters

  • $path string
public

joinPaths ( $basePath , $path ) : string

Join the given paths together.

Parameters

  • $basePath string
  • $path string
public

environmentPath ( ) : string

Get the path to the environment file directory.

public

useEnvironmentPath ( $path ) : $this

Set the directory for the environment file.

Parameters

  • $path string
public

loadEnvironmentFrom ( $file ) : $this

Set the environment file to be loaded during bootstrapping.

Parameters

  • $file string
public

environmentFile ( ) : string

Get the environment file the application is using.

public

environmentFilePath ( ) : string

Get the fully qualified path to the environment file.

public

environment ( $environments ) : string|bool

Get or check the current application environment.

Parameters

  • $environments string|array
public

isLocal ( ) : bool

Determine if the application is in the local environment.

public

isProduction ( ) : bool

Determine if the application is in the production environment.

public

detectEnvironment ( Closure $callback ) : string

Detect the application's current environment.

Parameters

public

runningInConsole ( ) : bool

Determine if the application is running in the console.

public

runningUnitTests ( ) : bool

Determine if the application is running unit tests.

public

hasDebugModeEnabled ( ) : bool

Determine if the application is running with debug mode enabled.

public

registerConfiguredProviders ( ) : void

Register all of the configured providers.

public

register ( $provider , $force ) : ServiceProvider

Register a service provider with the application.

Parameters

public

getProvider ( $provider ) : ServiceProvider |null

Get the registered service provider instance if it exists.

Parameters

public

getProviders ( $provider ) : array

Get the registered service provider instances if any exist.

Parameters

public

resolveProvider ( $provider ) : ServiceProvider

Resolve a service provider instance from the class name.

Parameters

  • $provider string
protected

markAsRegistered ( $provider ) : void

Mark the given provider as registered.

Parameters

public

loadDeferredProviders ( ) : void

Load and boot all of the remaining deferred providers.

public

loadDeferredProvider ( $service ) : void

Load the provider for a deferred service.

Parameters

  • $service string
public

registerDeferredProvider ( $provider , $service ) : void

Register a deferred provider and service.

Parameters

  • $provider string
  • $service string|null
public

make ( $abstract , array $parameters ) : mixed

Resolve the given type from the container.

Parameters

  • $abstract string
  • $parameters array
protected

resolve ( $abstract , $parameters , $raiseEvents ) : mixed

Resolve the given type from the container.

Parameters

  • $abstract string
  • $parameters array
  • $raiseEvents bool
protected

loadDeferredProviderIfNeeded ( $abstract ) : void

Load the deferred provider if the given type is a deferred service and the instance has not been loaded.

Parameters

  • $abstract string
public

bound ( $abstract ) : bool

Determine if the given abstract type has been bound.

Parameters

  • $abstract string
public

isBooted ( ) : bool

Determine if the application has booted.

public

boot ( ) : void

Boot the application's service providers.

protected

bootProvider ( ServiceProvider $provider ) : void

Boot the given service provider.

Parameters

public

booting ( $callback ) : void

Register a new boot listener.

Parameters

  • $callback callable
public

booted ( $callback ) : void

Register a new "booted" listener.

Parameters

  • $callback callable
protected

fireAppCallbacks ( array $callbacks ) : void

Call the booting callbacks for the application.

Parameters

  • $callbacks callable[]
public

handle ( Symfony\...\Request $request , int $type , bool $catch ) : Symfony\...\Response

{@inheritdoc}

public

shouldSkipMiddleware ( ) : bool

Determine if middleware has been disabled for the application.

public

getCachedServicesPath ( ) : string

Get the path to the cached services.php file.

public

getCachedPackagesPath ( ) : string

Get the path to the cached packages.php file.

public

configurationIsCached ( ) : bool

Determine if the application configuration is cached.

public

getCachedConfigPath ( ) : string

Get the path to the configuration cache file.

public

routesAreCached ( ) : bool

Determine if the application routes are cached.

public

getCachedRoutesPath ( ) : string

Get the path to the routes cache file.

public

eventsAreCached ( ) : bool

Determine if the application events are cached.

public

getCachedEventsPath ( ) : string

Get the path to the events cache file.

protected

normalizeCachePath ( $key , $default ) : string

Normalize a relative or absolute path to a cache file.

Parameters

  • $key string
  • $default string
public

addAbsoluteCachePathPrefix ( $prefix ) : $this

Add new prefix to list of absolute path prefixes.

Parameters

  • $prefix string
public

maintenanceMode ( ) : MaintenanceMode

Get an instance of the maintenance mode manager implementation.

public

isDownForMaintenance ( ) : bool

Determine if the application is currently down for maintenance.

public

abort ( $code , $message , array $headers ) : never

Throw an HttpException with the given data.

Parameters

  • $code int
  • $message string
  • $headers array
public

terminating ( $callback ) : $this

Register a terminating callback with the application.

Parameters

  • $callback callable|string
public

terminate ( ) : void

Terminate the application.

public

getLoadedProviders ( ) : array

Get the service providers that have been loaded.

public

providerIsLoaded ( string $provider ) : bool

Determine if the given service provider is loaded.

Parameters

  • $provider string
public

getDeferredServices ( ) : array

Get the application's deferred services.

public

setDeferredServices ( array $services ) : void

Set the application's deferred services.

Parameters

  • $services array
public

addDeferredServices ( array $services ) : void

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

Parameters

  • $services array
public

isDeferredService ( $service ) : bool

Determine if the given service is a deferred service.

Parameters

  • $service string
public

provideFacades ( $namespace ) : void

Configure the real-time facade namespace.

Parameters

  • $namespace string
public

getLocale ( ) : string

Get the current application locale.

public

currentLocale ( ) : string

Get the current application locale.

public

getFallbackLocale ( ) : string

Get the current application fallback locale.

public

setLocale ( $locale ) : void

Set the current application locale.

Parameters

  • $locale string
public

setFallbackLocale ( $fallbackLocale ) : void

Set the current application fallback locale.

Parameters

  • $fallbackLocale string
public

isLocale ( $locale ) : bool

Determine if the application locale is the given locale.

Parameters

  • $locale string
public

registerCoreContainerAliases ( ) : void

Register the core class aliases in the container.

public

flush ( ) : void

Flush the container of all bindings and resolved instances.

public

getNamespace ( ) : string

Get the application namespace.