Application
class Application extends Container implements HttpKernelInterface, TerminableInterface, ResponsePreparerInterface (View source)
Constants
VERSION | The Laravel framework version. |
Properties
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 | $instances | The container's shared instances. | from Container |
protected array | $aliases | The registered type aliases. | from Container |
protected array | $reboundCallbacks | All of the registered rebound callbacks. | from Container |
protected array | $resolvingCallbacks | All of the registered resolving callbacks. | from Container |
protected array | $globalResolvingCallbacks | All of the global resolving callbacks. | from Container |
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 | $finishCallbacks | The array of finish callbacks. | |
protected array | $shutdownCallbacks | The array of shutdown callbacks. | |
protected array | $middlewares | All of the developer defined middlewares. | |
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. | |
static protected string | $requestClass | The request class used by the application. |
Methods
bool | resolvable(string $abstract) Determine if a given string is resolvable. | 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 | 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 |
Closure | getClosure(string $abstract, string $concrete) Get the Closure to be used when building a type. | 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 |
Closure | share(Closure $closure) Wrap a Closure such that it is shared. | from Container |
void | bindShared(string $abstract, Closure $closure) Bind a shared Closure into the container. | from Container |
void | extend(string $abstract, Closure $closure) "Extend" an abstract type in the container. | |
Closure | getExtender(string $abstract, Closure $closure) Get an extender Closure for resolving a type. | from Container |
void | instance(string $abstract, mixed $instance) Register an existing instance as shared in the container. | from Container |
void | alias(string $abstract, string $alias) Alias a type to a shorter name. | from Container |
array | extractAlias(array $definition) Extract the type and alias from a given definition. | 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 |
mixed | make(string $abstract, array $parameters = array()) Resolve the given type from the container. | |
mixed | getConcrete(string $abstract) Get the concrete type for a given abstract. | from Container |
bool | missingLeadingSlash(string $abstract) Determine if the given abstract has a leading slash. | from Container |
mixed | build(string $concrete, array $parameters = array()) Instantiate a concrete instance of the given type. | from Container |
array | getDependencies(array $parameters, array $primitives = array()) Resolve all of the dependencies from the ReflectionParameters. | from Container |
mixed | resolveNonClass(ReflectionParameter $parameter) Resolve a non-class hinted dependency. | from Container |
mixed | resolveClass(ReflectionParameter $parameter) Resolve a class based dependency from the container. | from Container |
array | keyParametersByArgument(array $dependencies, array $parameters) If extra parameters are passed by numeric ID, rekey them by argument name. | from Container |
void | resolving(string $abstract, Closure $callback) Register a new resolving callback. | from Container |
void | resolvingAny(Closure $callback) Register a new resolving callback for all types. | from Container |
void | fireResolvingCallbacks(string $abstract, mixed $object) Fire all of the resolving callbacks. | from Container |
fireCallbackArray(mixed $object, array $callbacks) Fire an array of callbacks with an object. | from Container | |
bool | isShared(string $abstract) Determine if a given type is shared. | from Container |
bool | isBuildable(mixed $concrete, string $abstract) Determine if the given concrete is buildable. | from Container |
string | getAlias(string $abstract) Get the alias for an abstract if available. | from Container |
array | getBindings() Get the container's bindings. | 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 |
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(Request $request = null) Create a new Illuminate application instance. | |
Request | createNewRequest() Create a new request instance from the request class. | |
void | registerBaseBindings(Request $request) Register the basic bindings into the container. | |
void | registerBaseServiceProviders() Register all of the base service providers. | |
void | registerExceptionProvider() Register the exception service provider. | |
void | registerRoutingProvider() Register the routing service provider. | |
void | registerEventProvider() Register the event service provider. | |
void | bindInstallPaths(array $paths) Bind the installation paths to the application. | |
static string | getBootstrapFile() Get the application bootstrap file. | |
void | startExceptionHandling() Start the exception handling for the request. | |
string | environment() Get or check the current application environment. | |
bool | isLocal() Determine if application is in local environment. | |
string | detectEnvironment(array|string $envs) 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. | |
ServiceProvider | forceRegister(ServiceProvider|string $provider, array $options = array()) Force register a service provider with the application. | |
ServiceProvider | register(ServiceProvider|string $provider, array $options = array(), bool $force = false) Register a service provider with the application. | |
ServiceProvider|null | getRegistered(ServiceProvider|string $provider) Get the registered service provider instance if it exists. | |
ServiceProvider | resolveProviderClass(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 $service = null) Register a deferred provider and service. | |
void | before(Closure|string $callback) Register a "before" application filter. | |
void | after(Closure|string $callback) Register an "after" application filter. | |
void | finish(Closure|string $callback) Register a "finish" application filter. | |
void | shutdown(callable $callback = null) Register a "shutdown" callback. | |
void | useArraySessions(Closure $callback) Register a function for determining when to use array sessions. | |
bool | isBooted() Determine if the application has booted. | |
void | boot() Boot the application's service providers. | |
void | bootApplication() Boot the application and fire app callbacks. | |
void | booting(mixed $callback) Register a new boot listener. | |
void | booted(mixed $callback) Register a new "booted" listener. | |
void | run(Request $request = null) Run the application and send the response. | |
HttpKernelInterface | getStackedClient() Get the stacked HTTP kernel for the application. | |
void | mergeCustomMiddlewares(Builder $stack) Merge the developer defined middlewares onto the stack. | |
void | registerBaseMiddlewares() Register the default, but optional middlewares. | |
$this | middleware(string $class, array $parameters = array()) Add a HttpKernel middleware onto the stack. | |
void | forgetMiddleware(string $class) Remove a custom middleware from the application. | |
Response | handle(Request $request, int $type = HttpKernelInterface::MASTER_REQUEST, bool $catch = true) Handle the given request and get the response. | |
Response | dispatch(Request $request) Handle the given request and get the response. | |
void | terminate(Request $request, Response $response) Call the "finish" and "shutdown" callbacks assigned to the application. | |
void | refreshRequest(Request $request) Refresh the bound request instance in the container. | |
void | callFinishCallbacks(Request $request, Response $response) Call the "finish" callbacks assigned to the application. | |
void | fireAppCallbacks(array $callbacks) Call the booting callbacks for the application. | |
Request | prepareRequest(Request $request) Prepare the request by injecting any services. | |
Response | prepareResponse(mixed $value) Prepare the given value as a Response object. | |
bool | readyForResponses() Determine if the application is ready for responses. | |
bool | isDownForMaintenance() Determine if the application is currently down for maintenance. | |
void | down(Closure $callback) Register a maintenance mode event listener. | |
void | abort(int $code, string $message = '', array $headers = array()) Throw an HttpException with the given data. | |
void | missing(Closure $callback) Register a 404 error handler. | |
void | error(Closure $callback) Register an application error handler. | |
void | pushError(Closure $callback) Register an error handler at the bottom of the stack. | |
void | fatal(Closure $callback) Register an error handler for fatal errors. | |
LoaderInterface | getConfigLoader() Get the configuration loader instance. | |
EnvironmentVariablesLoaderInterface | getEnvironmentVariablesLoader() Get the environment variables loader instance. | |
ProviderRepository | getProviderRepository() Get the service provider repository instance. | |
array | getLoadedProviders() Get the service providers that have been loaded. | |
void | setDeferredServices(array $services) Set the application's deferred services. | |
bool | isDeferredService(string $service) Determine if the given service is a deferred service. | |
static string | requestClass(string $class = null) Get or set the request class for the application. | |
void | setRequestForConsoleEnvironment() Set the application request for the console environment. | |
static mixed | onRequest(string $method, array $parameters = array()) Call a method on the default request class. | |
string | getLocale() Get the current application locale. | |
void | setLocale(string $locale) Set the current application locale. | |
void | registerCoreContainerAliases() Register the core class aliases in the container. |
Details
protected bool resolvable(string $abstract)
Determine if a given string is resolvable.
bool bound(string $abstract)
Determine if the given abstract type has been bound.
(Overriding Container::bound)
bool resolved(string $abstract)
Determine if the given abstract type has been resolved.
bool isAlias(string $name)
Determine if a given string is an alias.
void bind(string|array $abstract, Closure|string|null $concrete = null, bool $shared = false)
Register a binding with the container.
protected Closure getClosure(string $abstract, string $concrete)
Get the Closure to be used when building a type.
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 bindShared(string $abstract, Closure $closure)
Bind a shared Closure into the container.
void extend(string $abstract, Closure $closure)
"Extend" an abstract type in the container.
(Overriding Container::extend)
protected Closure getExtender(string $abstract, Closure $closure)
Get an extender Closure for resolving a type.
void instance(string $abstract, mixed $instance)
Register an existing instance as shared in the container.
void alias(string $abstract, string $alias)
Alias a type to a shorter name.
protected array extractAlias(array $definition)
Extract the type and alias from a given definition.
mixed rebinding(string $abstract, Closure $callback)
Bind a new callback to an abstract's rebind event.
mixed refresh(string $abstract, mixed $target, string $method)
Refresh an instance on the given target and method.
protected void rebound(string $abstract)
Fire the "rebound" callbacks for the given abstract type.
protected array getReboundCallbacks(string $abstract)
Get the rebound callbacks for a given type.
mixed make(string $abstract, array $parameters = array())
Resolve the given type from the container.
(Overriding Container::make)
protected mixed getConcrete(string $abstract)
Get the concrete type for a given abstract.
protected bool missingLeadingSlash(string $abstract)
Determine if the given abstract has a leading slash.
mixed build(string $concrete, array $parameters = array())
Instantiate a concrete instance of the given type.
protected array getDependencies(array $parameters, array $primitives = array())
Resolve all of the dependencies from the ReflectionParameters.
protected mixed resolveNonClass(ReflectionParameter $parameter)
Resolve a non-class hinted dependency.
protected mixed resolveClass(ReflectionParameter $parameter)
Resolve a class based dependency from the container.
protected array keyParametersByArgument(array $dependencies, array $parameters)
If extra parameters are passed by numeric ID, rekey them by argument name.
void resolving(string $abstract, Closure $callback)
Register a new resolving callback.
void resolvingAny(Closure $callback)
Register a new resolving callback for all types.
protected void fireResolvingCallbacks(string $abstract, mixed $object)
Fire all of the resolving callbacks.
protected fireCallbackArray(mixed $object, array $callbacks)
Fire an array of callbacks with an object.
bool isShared(string $abstract)
Determine if a given type is shared.
protected bool isBuildable(mixed $concrete, string $abstract)
Determine if the given concrete is buildable.
protected string getAlias(string $abstract)
Get the alias for an abstract if available.
array getBindings()
Get the container's bindings.
protected void dropStaleInstances(string $abstract)
Drop all of the stale instances and aliases.
void forgetInstance(string $abstract)
Remove a resolved instance from the instance cache.
void forgetInstances()
Clear all of the instances from the container.
bool offsetExists(string $key)
Determine if a given offset exists.
mixed offsetGet(string $key)
Get the value at a given offset.
void offsetSet(string $key, mixed $value)
Set the value at a given offset.
void offsetUnset(string $key)
Unset the value at a given offset.
mixed __get(string $key)
Dynamically access container services.
void __set(string $key, mixed $value)
Dynamically set container services.
void __construct(Request $request = null)
Create a new Illuminate application instance.
protected Request createNewRequest()
Create a new request instance from the request class.
protected void registerBaseBindings(Request $request)
Register the basic bindings into the container.
protected void registerBaseServiceProviders()
Register all of the base service providers.
protected void registerExceptionProvider()
Register the exception service provider.
protected void registerRoutingProvider()
Register the routing service provider.
protected void registerEventProvider()
Register the event service provider.
void bindInstallPaths(array $paths)
Bind the installation paths to the application.
static string getBootstrapFile()
Get the application bootstrap file.
void startExceptionHandling()
Start the exception handling for the request.
string environment()
Get or check the current application environment.
bool isLocal()
Determine if application is in local environment.
string detectEnvironment(array|string $envs)
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.
ServiceProvider forceRegister(ServiceProvider|string $provider, array $options = array())
Force register a service provider with the application.
ServiceProvider register(ServiceProvider|string $provider, array $options = array(), bool $force = false)
Register a service provider with the application.
ServiceProvider|null getRegistered(ServiceProvider|string $provider)
Get the registered service provider instance if it exists.
ServiceProvider resolveProviderClass(string $provider)
Resolve a service provider instance from the class name.
protected void markAsRegistered(ServiceProvider $provider)
Mark the given provider as registered.
void loadDeferredProviders()
Load and boot all of the remaining deferred providers.
protected void loadDeferredProvider(string $service)
Load the provider for a deferred service.
void registerDeferredProvider(string $provider, string $service = null)
Register a deferred provider and service.
void before(Closure|string $callback)
Register a "before" application filter.
void after(Closure|string $callback)
Register an "after" application filter.
void finish(Closure|string $callback)
Register a "finish" application filter.
void shutdown(callable $callback = null)
Register a "shutdown" callback.
void useArraySessions(Closure $callback)
Register a function for determining when to use array sessions.
bool isBooted()
Determine if the application has booted.
void boot()
Boot the application's service providers.
protected void bootApplication()
Boot the application and fire app callbacks.
void booting(mixed $callback)
Register a new boot listener.
void booted(mixed $callback)
Register a new "booted" listener.
void run(Request $request = null)
Run the application and send the response.
protected HttpKernelInterface getStackedClient()
Get the stacked HTTP kernel for the application.
protected void mergeCustomMiddlewares(Builder $stack)
Merge the developer defined middlewares onto the stack.
protected void registerBaseMiddlewares()
Register the default, but optional middlewares.
$this middleware(string $class, array $parameters = array())
Add a HttpKernel middleware onto the stack.
void forgetMiddleware(string $class)
Remove a custom middleware from the application.
Response handle(Request $request, int $type = HttpKernelInterface::MASTER_REQUEST, bool $catch = true)
Handle the given request and get the response.
Provides compatibility with BrowserKit functional testing.
Response dispatch(Request $request)
Handle the given request and get the response.
void terminate(Request $request, Response $response)
Call the "finish" and "shutdown" callbacks assigned to the application.
protected void refreshRequest(Request $request)
Refresh the bound request instance in the container.
void callFinishCallbacks(Request $request, Response $response)
Call the "finish" callbacks assigned to the application.
protected void fireAppCallbacks(array $callbacks)
Call the booting callbacks for the application.
Response prepareResponse(mixed $value)
Prepare the given value as a Response object.
bool readyForResponses()
Determine if the application is ready for responses.
bool isDownForMaintenance()
Determine if the application is currently down for maintenance.
void down(Closure $callback)
Register a maintenance mode event listener.
void abort(int $code, string $message = '', array $headers = array())
Throw an HttpException with the given data.
void missing(Closure $callback)
Register a 404 error handler.
void error(Closure $callback)
Register an application error handler.
void pushError(Closure $callback)
Register an error handler at the bottom of the stack.
void fatal(Closure $callback)
Register an error handler for fatal errors.
LoaderInterface getConfigLoader()
Get the configuration loader instance.
EnvironmentVariablesLoaderInterface getEnvironmentVariablesLoader()
Get the environment variables loader instance.
ProviderRepository getProviderRepository()
Get the service provider repository instance.
array getLoadedProviders()
Get the service providers that have been loaded.
void setDeferredServices(array $services)
Set the application's deferred services.
bool isDeferredService(string $service)
Determine if the given service is a deferred service.
static string requestClass(string $class = null)
Get or set the request class for the application.
void setRequestForConsoleEnvironment()
Set the application request for the console environment.
static mixed onRequest(string $method, array $parameters = array())
Call a method on the default request class.
string getLocale()
Get the current application locale.
void setLocale(string $locale)
Set the current application locale.
void registerCoreContainerAliases()
Register the core class aliases in the container.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/4.2/Illuminate/Foundation/Application.html