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
Determine if the given abstract type has been bound.
Determine if the given abstract type has been resolved.
Register a binding with the container.
Get the Closure to be used when building a type.
Register a binding if it hasn't already been registered.
Register a shared binding in the container.
Register an existing instance as shared in the container.
Extract the type and alias from a given definition.
Refresh an instance on the given target and method.
Fire the "rebound" callbacks for the given abstract type.
Get the rebound callbacks for a given type.
Resolve the given type from the container.
Determine if the given abstract has a leading slash.
Instantiate a concrete instance of the given type.
Resolve all of the dependencies from the ReflectionParameters.
If extra parameters are passed by numeric ID, rekey them by argument name.
Fire all of the resolving callbacks.
Fire an array of callbacks with an object.
Determine if the given concrete is buildable.
Drop all of the stale instances and aliases.
Remove a resolved instance from the instance cache.
Create a new request instance from the request class.
Register all of the base service providers.
Register the exception service provider.
Register the routing service provider.
Register the event service provider.
Bind the installation paths to the application.
Get the application bootstrap file.
Start the exception handling for the request.
Get or check the current application environment.
Determine if application is in local environment.
Detect the application's current environment.
Determine if we are running in the console.
Determine if we are running unit tests.
Force register a service provider with the application.
Register a service provider with the application.
Get the registered service provider instance if it exists.
Resolve a service provider instance from the class name.
Mark the given provider as registered.
Load and boot all of the remaining deferred providers.
Load the provider for a deferred service.
Register a deferred provider and service.
Register a "shutdown" callback.
Determine if the application has booted.
Boot the application's service providers.
Boot the application and fire app callbacks.
Register a new boot listener.
Register a new "booted" listener.
Run the application and send the response.
Get the stacked HTTP kernel for the application.
Merge the developer defined middlewares onto the stack.
Register the default, but optional middlewares.
Add a HttpKernel middleware onto the stack.
Remove a custom middleware from the application.
Handle the given request and get the response.
Call the "finish" and "shutdown" callbacks assigned to the application.
Call the "finish" callbacks assigned to the application.
Call the booting callbacks for the application.
Prepare the given value as a Response object.
Determine if provider is ready to return responses.
Determine if the application is currently down for maintenance.
Throw an HttpException with the given data.
Get the configuration loader instance.
Get the environment variables loader instance.
Get the service provider repository instance.
Get the service providers that have been loaded.
Set the application's deferred services.
Determine if the given service is a deferred service.
Get or set the request class for the application.
Set the application request for the console environment.
Call a method on the default request class.
Get the current application locale.
Set the current application locale.
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.
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.
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.
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($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 provider is ready to return 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.