Application
class Application extends Container implements Application, CachesConfiguration, CachesRoutes
Traits
Constants
| protected BUILD_STACK_CONTEXT_KEY |
Context key for the coroutine-local build stack. |
| DEPTH_CONTEXT_KEY |
Context key for the coroutine-local resolution depth counter. |
| protected RESOLVING_STACK_CONTEXT_KEY |
Context key for the coroutine-local resolving stack. Tracks abstracts currently being resolved, used exclusively for circular dependency detection. Separate from BUILD_STACK_CONTEXT_KEY (which is also used by call() for contextual binding lookup) to avoid false positives when call() pushes a class name that is then re-resolved inside the method body. |
| protected MAX_RESOLUTION_DEPTH |
Maximum resolution depth before assuming a circular dependency. Safety net for indirect cycles (e.g., through interfaces) where the abstract names differ from the concretes pushed by build(), making the direct in_array check insufficient. |
| protected PARAMETER_OVERRIDES_CONTEXT_KEY |
Context key for the coroutine-local parameter override stack. |
| protected SCOPED_CONTEXT_PREFIX |
Context key prefix for coroutine-local scoped instances. |
| VERSION |
The Hypervel framework version. |
Properties
| static protected null|Container | $instance | The current globally available container (if any). |
from Container |
| protected bool[] | $resolved | An array of the types that have been resolved. |
from Container |
| protected array[] | $bindings | The container's bindings. |
from Container |
| protected Closure[] | $methodBindings | The container's method bindings. |
from Container |
| protected array<string, mixed> | $instances | The container's shared instances. |
from Container |
| protected object[] | $autoSingletons | Auto-singletoned instances for unbound concrete classes. |
from Container |
| protected SharedResolution> | $sharedResolutions | Cacheable first resolutions currently owned by a coroutine. |
from Container |
| protected array<int, int> | $sharedResolutionWaits | Container waits keyed by the waiting coroutine ID. |
from Container |
| protected array<string, true> | $scopedInstances | The abstract names registered as scoped bindings. |
from Container |
| protected string[] | $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 |
| array[] | $contextual | The contextual binding map. |
from Container |
| array[] | $contextualAttributes | The contextual attribute handlers. |
from Container |
| protected array<class-string, true> | $checkedForAttributeBindings | Whether an abstract class has already had its attributes checked for bindings. |
from Container |
| protected array<class-string, null|"scoped"|"singleton"> | $checkedForSingletonOrScopedAttributes | Whether a class has already been checked for Singleton or Scoped attributes. |
from Container |
| protected array[] | $reboundCallbacks | All of the registered rebound callbacks. |
from Container |
| protected Closure[] | $globalBeforeResolvingCallbacks | All of the global before resolving callbacks. |
from Container |
| protected Closure[] | $globalResolvingCallbacks | All of the global resolving callbacks. |
from Container |
| protected Closure[] | $globalAfterResolvingCallbacks | All of the global after resolving callbacks. |
from Container |
| protected array[] | $beforeResolvingCallbacks | All of the before resolving callbacks by class type. |
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 Closure>> | $afterResolvingAttributeCallbacks | All of the after resolving attribute callbacks by class type. |
from Container |
| protected null|(callable(array<int, string>|string): bool|string) | $environmentResolver | The callback used to determine the container's environment. |
from Container |
| static protected BuildRecipe> | $buildRecipes | Cache of computed build recipes. |
from Container |
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected string|null | $basePath | The base path for the Hypervel installation. |
|
| protected string | $bootstrapPath | The path to the bootstrap directory. |
|
| protected string|null | $storagePath | The custom storage path defined by the developer. |
|
| protected string|null | $appPath | The custom application "app" path defined by the developer. |
|
| protected string|null | $configPath | The custom configuration path defined by the developer. |
|
| protected string|null | $databasePath | The custom database path defined by the developer. |
|
| protected string|null | $langPath | The custom language file path defined by the developer. |
|
| protected string|null | $publicPath | The custom public path defined by the developer. |
|
| protected string|null | $environmentPath | The custom environment path defined by the developer. |
|
| protected string|null | $environmentFile | The environment file to load during bootstrapping. |
|
| protected string[] | $absoluteCachePathPrefixes | The prefixes that indicate an absolute cache path. |
|
| protected bool | $mergeFrameworkConfiguration | Indicates if the framework's base configuration should be merged. |
|
| protected bool | $hasBeenBootstrapped | Indicates if the application has been bootstrapped before. |
|
| protected bool|null | $isRunningInConsole | Indicates if the application is running in the console. |
|
| protected bool | $booted | Indicates if the application has "booted". |
|
| protected callable[] | $bootingCallbacks | The array of booting callbacks. |
|
| protected callable[] | $bootedCallbacks | The array of booted callbacks. |
|
| protected array<callable|string> | $terminatingCallbacks | The array of terminating callbacks. |
|
| protected callable[] | $registeredCallbacks | The array of registered callbacks. |
|
| protected ServiceProvider> | $serviceProviders | All of the registered service providers. |
|
| protected array | $loadedProviders | The names of the loaded service providers. |
|
| protected string|null | $namespace | The application namespace. |
Methods
Get the class name of the first parameter of the given Closure.
Get the class names of the first parameter of the given Closure, including union types.
Get the class names / types of the parameters of the given Closure.
Get the class names / types of the return type of the given Closure.
Define a contextual binding based on an attribute.
Determine if the given abstract type has been bound.
Determine if the given abstract type has been resolved.
Determine if a ReflectionClass has scoping attributes applied.
Register a binding with the container.
Register one binding and its lifecycle.
Get the Closure to be used when building a type.
Determine if the container has a method binding.
Bind a callback to resolve with Container::call.
Get the method to be bound in class@method format.
Get the method binding for the given method.
Add a contextual binding to the container.
Register a binding if it hasn't already been registered.
Register a shared binding in the container.
Register a shared binding if it hasn't already been registered.
Register a scoped binding in the container.
Register a scoped binding if it hasn't already been registered.
Register a binding with the container based on the given Closure's return types.
Register an existing instance as shared in the container.
Remove an alias from the contextual binding alias cache.
Assign a set of tags to a given binding.
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.
Wrap the given closure such that its dependencies will be injected when executed.
Call the given Closure / class@method and inject its dependencies.
Get the class name for the given callback, if one can be determined.
Get a closure to resolve the given type from the container.
An alias function name for make().
Resolve the given type from the container.
Resolve the given type from the container.
Determine whether this miss can publish a worker-shared instance.
Wait for a shared resolution without introducing a coordinator cycle.
Determine whether the resolution owner is an ancestor of a coroutine.
Determine whether adding a container wait edge would close a cycle.
Get the concrete binding for an abstract from the Bind attribute.
Get the contextual concrete binding for the given abstract.
Push an abstract onto the coroutine-local build stack.
Push an abstract onto the coroutine-local resolving stack.
Pop the last entry from the coroutine-local resolving stack.
Get the parameter override stack from coroutine-local context.
Push parameter overrides onto the coroutine-local stack.
Pop the last parameter overrides from the coroutine-local stack.
Get the last parameter override from the coroutine-local stack.
Find the concrete binding for the given abstract in the contextual binding array.
Determine if the given concrete is buildable.
Get the cached build recipe for the given concrete class.
Compute the build recipe for the given concrete class.
Instantiate a concrete instance with the given parameter overrides.
Instantiate a concrete instance of the given self building type.
Resolve all constructor parameters using cached recipe metadata.
Determine if the given dependency has a parameter override.
Resolve a class based variadic dependency from the container.
Resolve a dependency based on an attribute.
Throw an exception that the concrete is not instantiable.
Register a new before resolving callback for all types.
Register a new resolving callback.
Register a new after resolving callback for all types.
Register a new after resolving attribute callback for all types.
Fire all of the before resolving callbacks.
Fire an array of callbacks with an object.
Fire all of the resolving callbacks.
Fire all of the after resolving callbacks.
Fire all of the after resolving attribute callbacks.
Fire all callbacks that match the given abstract or object type.
Fire an array of callbacks with an object.
Get the name of the binding the container is currently resolving.
Remove all of the extender callbacks for a given type.
Drop all of the stale instances and aliases.
Forget every cached instance for an abstract without changing its lifecycle.
Remove a resolved instance from the instance cache.
Set the callback which determines the current container environment.
Determine the environment for the container.
Flush the container of all bindings and resolved instances.
Flush all static state.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
No description
Check that the runtime environment is properly configured.
Configure and create a new application builder instance.
Infer the application's base directory from the environment.
Get the version number of the application.
Register the basic bindings into the container.
Register all of the base service providers.
Run the given array of bootstrap classes.
Register a callback to run before a bootstrapper.
Register a callback to run after a bootstrapper.
Register a callback to run after loading the environment.
Determine if the application has been bootstrapped before.
Set the base path for the application.
Bind all of the application paths in the container.
Get the path to the application "app" directory.
Set the application directory.
Get the base path of the Hypervel installation.
Get the path to the bootstrap directory.
Set the bootstrap file directory.
Get the path to the service provider list in the bootstrap directory.
Get the path to the application configuration files.
Set the configuration directory.
Get the path to the database directory.
Set the database directory.
Get the path to the language files.
Set the language file directory.
Get the path to the public directory.
Set the public / web directory.
Get the path to the resources directory.
Get the path to the views directory.
Get the path to the storage directory.
Set the storage directory.
Get the path to the environment file directory.
Set the directory for the environment file.
Set the environment file to be loaded during bootstrapping.
Get the environment file the application is using.
Get the fully qualified path to the environment file.
Determine if the application configuration is cached.
Get the path to the configuration cache file.
Get the path to the cached packages.php file.
Determine if the application routes are cached.
Get the path to the routes cache file.
Determine if the application events are cached.
Get the path to the events cache file.
Normalize a relative or absolute path to a cache file.
Add new prefix to list of absolute path prefixes.
Join the given paths together.
Get or check the current application environment.
Determine if the application is in the local environment.
Determine if the application is in the production environment.
Determine if the application is running in the console.
Determine if the application is running any of the given console commands.
Set whether the application is running in the console.
Determine if the application is running unit tests.
Determine if the application is running with debug mode enabled.
Get an instance of the maintenance mode manager implementation.
Determine if the application is currently down for maintenance.
Handle the incoming Artisan command.
Determine if the framework's base configuration should be merged.
Indicate that the framework's base configuration should not be merged.
Determine if middleware has been disabled for the application.
Register a new registered listener.
Register all of the configured providers.
Discover service providers from installed composer packages.
Sort providers by their priority property in descending order.
Register a service provider with the application.
Get the registered service provider instance if it exists.
Get the registered service provider instances if any exist.
Resolve a service provider instance from the class name.
Determine if the application has booted.
Boot the application's service providers.
Register a new boot listener.
Register a new "booted" listener.
Register a terminating callback with the application.
Terminate the application.
Call the booting callbacks for the application.
Throw an HttpException with the given data.
Get the service providers that have been loaded.
Determine if the given service provider is loaded.
Get the current application locale.
Determine if the application locale is the given locale.
Get the current application locale.
Get the current application fallback locale.
Set the current application locale.
Set the current application fallback locale.
Register the core class aliases in the container.
Get the application namespace.
Details
in
ReflectsClosures at line 25
protected string
firstClosureParameterType(Closure $closure)
Get the class name of the first parameter of the given Closure.
in
ReflectsClosures at line 48
protected array
firstClosureParameterTypes(Closure $closure)
Get the class names of the first parameter of the given Closure, including union types.
in
ReflectsClosures at line 74
protected array
closureParameterTypes(Closure $closure)
Get the class names / types of the parameters of the given Closure.
in
ReflectsClosures at line 94
protected array
closureReturnTypes(Closure $closure)
Get the class names / types of the return type of the given Closure.
in
Container at line 284
ContextualBindingBuilder
when(string|array $concrete)
Define a contextual binding.
in
Container at line 298
void
whenHasAttribute(string $attribute, Closure $handler)
Define a contextual binding based on an attribute.
in
Container at line 306
bool
bound(string $abstract)
Determine if the given abstract type has been bound.
at line 294
bool
has(string $id)
Determine if the given abstract type has been bound.
The facade system calls has() before get() to check if a service is resolvable. With auto-singleton semantics, any concrete class can be resolved, so has() must return true for existing classes.
in
Container at line 322
bool
resolved(string $abstract)
Determine if the given abstract type has been resolved.
in
Container at line 336
bool
isShared(string $abstract)
Determine if a given type is shared.
in
Container at line 368
bool
isScoped(string $abstract)
Determine if a given abstract is a scoped binding.
in
Container at line 393
protected string|null
getScopedType(ReflectionClass|string $reflection)
Determine if a ReflectionClass has scoping attributes applied.
in
Container at line 425
bool
isAlias(string $name)
Determine if a given string is an alias.
in
Container at line 440
void
bind(Closure|string $abstract, Closure|string|null $concrete = null, bool $shared = false)
Register a binding with the container.
Boot-only. Bindings persist on the worker-lifetime container; runtime use races across coroutines and changes resolution for every subsequent request.
in
Container at line 458
protected void
registerBinding(string $abstract, Closure|string|null $concrete, bool $shared, bool $scoped)
Register one binding and its lifecycle.
in
Container at line 495
protected Closure
getClosure(string $abstract, string $concrete)
Get the Closure to be used when building a type.
in
Container at line 513
bool
hasMethodBinding(string $method)
Determine if the container has a method binding.
in
Container at line 524
void
bindMethod(array|string $method, Closure $callback)
Bind a callback to resolve with Container::call.
Boot-only. Method bindings persist on the worker-lifetime container and affect every subsequent Container::call() for the bound method.
in
Container at line 532
protected string
parseBindMethod(array|string $method)
Get the method to be bound in class@method format.
in
Container at line 544
mixed
callMethodBinding(string $method, mixed $instance)
Get the method binding for the given method.
in
Container at line 556
void
addContextualBinding(string $concrete, string $abstract, mixed $implementation)
Add a contextual binding to the container.
Boot-only. Contextual bindings persist on the worker-lifetime container; runtime use races across coroutines and changes dependency resolution for every subsequent build of the concrete.
in
Container at line 567
void
bindIf(Closure|string $abstract, Closure|string|null $concrete = null, bool $shared = false)
Register a binding if it hasn't already been registered.
Boot-only. Conditional bindings mutate the worker-lifetime container for every subsequent request.
in
Container at line 592
void
singleton(Closure|string $abstract, Closure|string|null $concrete = null)
Register a shared binding in the container.
Boot-only. Singleton bindings persist on the worker-lifetime container; runtime use races across coroutines and changes shared resolution for every subsequent request.
in
Container at line 603
void
singletonIf(Closure|string $abstract, Closure|string|null $concrete = null)
Register a shared binding if it hasn't already been registered.
Boot-only. Conditional singleton bindings mutate the worker-lifetime container for every subsequent request.
in
Container at line 614
void
scoped(Closure|string $abstract, Closure|string|null $concrete = null)
Register a scoped binding in the container.
Boot-only. Scoped binding definitions persist on the worker-lifetime container; only their resolved instances are coroutine-scoped.
in
Container at line 631
void
scopedIf(Closure|string $abstract, Closure|string|null $concrete = null)
Register a scoped binding if it hasn't already been registered.
Boot-only. Conditional scoped bindings mutate the worker-lifetime container for every subsequent request.
in
Container at line 653
protected void
bindBasedOnClosureReturnTypes(Closure $abstract, Closure|string|null $concrete = null, bool $shared = false, bool $scoped = false, bool $onlyIfUnbound = false)
Register a binding with the container based on the given Closure's return types.
in
Container at line 681
void
extend(string $abstract, Closure $closure)
"Extend" an abstract type in the container.
Boot-only. The extender persists in the container's $extenders array for the worker lifetime and runs on every subsequent resolution of $abstract.
in
Container at line 725
mixed
instance(string $abstract, mixed $instance)
Register an existing instance as shared in the container.
Tests only. Replaces a worker-lifetime shared instance; runtime use races across coroutines and changes the object returned to every subsequent resolver.
in
Container at line 750
protected void
removeAbstractAlias(string $searched)
Remove an alias from the contextual binding alias cache.
in
Container at line 771
void
tag(array|string $abstracts, array|string $tags)
Assign a set of tags to a given binding.
Boot-only. Tags persist on the worker-lifetime container and affect every subsequent tagged() resolution.
in
Container at line 789
iterable
tagged(string $tag)
Resolve all of the bindings for a given tag.
in
Container at line 811
void
alias(string $abstract, string $alias)
Alias a type to a different name.
Boot-only. Aliases persist on the worker-lifetime container; runtime use races across coroutines and changes resolution for every subsequent request.
in
Container at line 846
mixed
rebinding(string $abstract, Closure $callback)
Bind a new callback to an abstract's rebind event.
Boot-only. Rebinding callbacks persist on the worker-lifetime container and run whenever the abstract is rebound later in the worker.
in
Container at line 863
mixed
refresh(string $abstract, mixed $target, string $method)
Refresh an instance on the given target and method.
Boot-only. Registers a rebinding callback on the worker-lifetime container; runtime use leaks the callback across later rebindings.
in
Container at line 873
protected void
rebound(string $abstract)
Fire the "rebound" callbacks for the given abstract type.
in
Container at line 889
protected array
getReboundCallbacks(string $abstract)
Get the rebound callbacks for a given type.
in
Container at line 897
Closure
wrap(Closure $callback, array $parameters = [])
Wrap the given closure such that its dependencies will be injected when executed.
in
Container at line 909
mixed
call(callable|string $callback, array $parameters = [], string|null $defaultMethod = null)
Call the given Closure / class@method and inject its dependencies.
in
Container at line 974
protected string|false
getClassForCallable(callable|string $callback)
Get the class name for the given callback, if one can be determined.
Closures are handled directly in call() before this method is reached, so this only needs to handle non-closure callable types.
in
Container at line 999
Closure
factory(string $abstract)
Get a closure to resolve the given type from the container.
in
Container at line 1014
mixed
makeWith(string $abstract, array $parameters = [])
An alias function name for make().
in
Container at line 1029
mixed
make(string $abstract, array $parameters = [])
Resolve the given type from the container.
in
Container at line 1043
mixed
get(string $id)
No description
in
Container at line 1067
protected mixed
resolve(string $abstract, array $parameters = [], bool $raiseEvents = true)
Resolve the given type from the container.
in
Container at line 1293
protected bool
shouldCoordinateSharedResolution(string $abstract, mixed $concrete, bool $needsContextualBuild, bool $raiseEvents)
Determine whether this miss can publish a worker-shared instance.
in
Container at line 1317
protected mixed
awaitSharedResolution(string $abstract, SharedResolution $resolution)
Wait for a shared resolution without introducing a coordinator cycle.
in
Container at line 1347
protected bool
sharedResolutionOwnerIsAncestor(int $ownerId, int $coroutineId)
Determine whether the resolution owner is an ancestor of a coroutine.
in
Container at line 1367
protected bool
sharedResolutionWaitWouldCycle(int $waiterId, int $ownerId)
Determine whether adding a container wait edge would close a cycle.
in
Container at line 1383
protected mixed
getConcrete(string $abstract)
Get the concrete type for a given abstract.
in
Container at line 1403
protected mixed
getConcreteBindingFromAttributes(string $abstract)
Get the concrete binding for an abstract from the Bind attribute.
in
Container at line 1457
protected mixed
getContextualConcrete(string $abstract)
Get the contextual concrete binding for the given abstract.
in
Container at line 1484
protected array
getBuildStack()
Get the current build stack from coroutine-local context.
in
Container at line 1494
protected void
setBuildStack(array $stack)
Set the build stack in coroutine-local context.
in
Container at line 1502
protected void
pushBuildStack(string $abstract)
Push an abstract onto the coroutine-local build stack.
in
Container at line 1512
protected void
popBuildStack()
Pop the last entry from the coroutine-local build stack.
in
Container at line 1528
protected array
getResolvingStack()
Get the resolving stack from coroutine-local context.
Used exclusively for circular dependency detection. Separate from the build stack so that call()'s contextual-binding pushes don't trigger false positives.
in
Container at line 1536
protected void
pushResolvingStack(string $abstract)
Push an abstract onto the coroutine-local resolving stack.
in
Container at line 1546
protected void
popResolvingStack()
Pop the last entry from the coroutine-local resolving stack.
in
Container at line 1558
protected array
getParameterOverrideStack()
Get the parameter override stack from coroutine-local context.
in
Container at line 1566
protected void
pushParameterOverrides(array $parameters)
Push parameter overrides onto the coroutine-local stack.
in
Container at line 1576
protected void
popParameterOverrides()
Pop the last parameter overrides from the coroutine-local stack.
in
Container at line 1586
protected array
getLastParameterOverride()
Get the last parameter override from the coroutine-local stack.
in
Container at line 1595
protected mixed
findInContextualBindings(string $abstract)
Find the concrete binding for the given abstract in the contextual binding array.
in
Container at line 1605
protected bool
isBuildable(mixed $concrete, string $abstract)
Determine if the given concrete is buildable.
in
Container at line 1613
protected BuildRecipe
getBuildRecipe(string $concrete)
Get the cached build recipe for the given concrete class.
in
Container at line 1625
protected BuildRecipe
computeBuildRecipe(string $concrete)
Compute the build recipe for the given concrete class.
Analyzes the class via reflection and caches the result as a BuildRecipe. This happens once per class per worker lifetime, avoiding repeated reflection on every build() call.
in
Container at line 1687
mixed
buildWith(Closure|string $concrete, array $parameters = [])
Instantiate a concrete instance with the given parameter overrides.
Bypasses all binding lookups and the auto-singleton cache, so the returned instance is always freshly constructed. Class-typed dependencies are still resolved via the container.
in
Container at line 1709
mixed
build(Closure|string $concrete)
Instantiate a concrete instance of the given type.
in
Container at line 1788
protected mixed
buildSelfBuildingInstance(string $concrete, BuildRecipe $recipe)
Instantiate a concrete instance of the given self building type.
in
Container at line 1817
protected array
resolveRecipeParameters(BuildRecipe $recipe)
Resolve all constructor parameters using cached recipe metadata.
in
Container at line 1866
protected bool
hasParameterOverride(ParameterRecipe $param)
Determine if the given dependency has a parameter override.
in
Container at line 1877
protected mixed
getParameterOverride(ParameterRecipe $param)
Get a parameter override for a dependency.
in
Container at line 1887
protected mixed
resolvePrimitive(ParameterRecipe $param)
Resolve a non-class hinted primitive dependency.
in
Container at line 1913
protected mixed
resolveClass(ParameterRecipe $param)
Resolve a class based dependency from the container.
in
Container at line 1943
protected mixed
resolveVariadicClass(ParameterRecipe $param)
Resolve a class based variadic dependency from the container.
in
Container at line 1961
mixed
resolveFromAttribute(ReflectionAttribute $attribute, ReflectionParameter $parameter)
Resolve a dependency based on an attribute.
in
Container at line 1983
protected never
notInstantiable(string $concrete)
Throw an exception that the concrete is not instantiable.
in
Container at line 2003
protected never
unresolvablePrimitive(ParameterRecipe $param)
Throw an exception for an unresolvable primitive.
in
Container at line 2016
void
beforeResolving(Closure|string $abstract, Closure|null $callback = null)
Register a new before resolving callback for all types.
Boot-only. The callback persists on the worker-lifetime container and runs before every matching future resolution.
in
Container at line 2035
void
resolving(Closure|string $abstract, Closure|null $callback = null)
Register a new resolving callback.
Boot-only. The callback persists on the worker-lifetime container and runs during every matching future resolution.
in
Container at line 2054
void
afterResolving(Closure|string $abstract, Closure|null $callback = null)
Register a new after resolving callback for all types.
Boot-only. The callback persists on the worker-lifetime container and runs after every matching future resolution.
in
Container at line 2073
void
afterResolvingAttribute(string $attribute, Closure $callback)
Register a new after resolving attribute callback for all types.
Boot-only. The callback persists on the worker-lifetime container and runs after every future resolution with the matching attribute.
in
Container at line 2081
protected void
fireBeforeResolvingCallbacks(string $abstract, array $parameters = [])
Fire all of the before resolving callbacks.
in
Container at line 2099
protected void
fireBeforeCallbackArray(string $abstract, array $parameters, array $callbacks)
Fire an array of callbacks with an object.
in
Container at line 2109
protected void
fireResolvingCallbacks(string $abstract, mixed $object)
Fire all of the resolving callbacks.
in
Container at line 2128
protected void
fireAfterResolvingCallbacks(string $abstract, mixed $object)
Fire all of the after resolving callbacks.
in
Container at line 2140
void
fireAfterResolvingAttributeCallbacks(array $attributes, mixed $object)
Fire all of the after resolving attribute callbacks.
in
Container at line 2172
protected void
fireCallbacksForType(string $abstract, mixed $object, array $callbacksPerType)
Fire all callbacks that match the given abstract or object type.
in
Container at line 2186
protected void
fireCallbackArray(mixed $object, array $callbacks)
Fire an array of callbacks with an object.
in
Container at line 2198
string|null
currentlyResolving()
Get the name of the binding the container is currently resolving.
in
Container at line 2208
array
getBindings()
Get the container's bindings.
in
Container at line 2216
string
getAlias(string $abstract)
Get the alias for an abstract if available.
in
Container at line 2226
protected array
getExtenders(string $abstract)
Get the extender callbacks for a given type.
in
Container at line 2238
void
forgetExtenders(string $abstract)
Remove all of the extender callbacks for a given type.
Boot or tests only. Clears worker-lifetime extender callbacks; concurrent resolutions may diverge depending on whether they resolved before or after the removal.
in
Container at line 2246
protected void
dropStaleInstances(string $abstract)
Drop all of the stale instances and aliases.
in
Container at line 2257
protected void
forgetCachedInstances(string $abstract)
Forget every cached instance for an abstract without changing its lifecycle.
in
Container at line 2271
void
forgetInstance(string $abstract)
Remove a resolved instance from the instance cache.
Boot or tests only. Clears a worker-lifetime shared instance and current coroutine scoped instance; concurrent coroutines may still hold references that next resolution will not share.
in
Container at line 2283
void
forgetInstances()
Clear all of the instances from the container.
Boot or tests only. Clears worker-lifetime shared instances and all scoped context entries known to this container; concurrent coroutines may still hold references that next resolution will not share.
in
Container at line 2297
void
forgetScopedInstances()
Clear all of the scoped instances from the container.
Boot or tests only. Clears scoped context entries known to this container; runtime use can invalidate scoped services while a coroutine is still handling a request.
in
Container at line 2312
void
resolveEnvironmentUsing(callable|null $callback)
Set the callback which determines the current container environment.
Boot-only. The resolver persists on the worker-lifetime container and is used by every currentEnvironmentIs() call.
in
Container at line 2322
bool
currentEnvironmentIs(array|string $environments)
Determine the environment for the container.
at line 1477
void
flush()
Flush the container of all bindings and resolved instances.
in
Container at line 2360
static Container
getInstance()
Get the globally available instance of the container.
in
Container at line 2371
static Container|null
setInstance(Container|null $container = null)
Set the shared instance of the container.
Tests only. Replaces the process-wide container singleton; runtime use races across coroutines and breaks every facade/global container lookup.
at line 1500
static void
flushState()
Flush all static state.
in
Container at line 2389
bool
offsetExists(string $key)
Determine if a given offset exists.
in
Container at line 2399
mixed
offsetGet(string $key)
Get the value at a given offset.
in
Container at line 2410
void
offsetSet(string $key, mixed $value)
Set the value at a given offset.
in
Container at line 2420
void
offsetUnset(string $key)
Unset the value at a given offset.
in
Container at line 2430
mixed
__get(string $key)
Dynamically access container services.
in
Container at line 2438
void
__set(string $key, mixed $value)
Dynamically set container services.
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 172
__construct(string|null $basePath = null)
No description
at line 188
protected void
checkEnvironment()
Check that the runtime environment is properly configured.
at line 200
static ApplicationBuilder
configure(string|null $basePath = null)
Configure and create a new application builder instance.
at line 221
static string
inferBasePath()
Infer the application's base directory from the environment.
Precedence is $_ENV, $_SERVER, Env repository, then Composer. Hypervel checks $_SERVER and Env so test helpers and worker environments can provide APP_BASE_PATH without writing to $_ENV.
at line 237
string
version()
Get the version number of the application.
at line 245
protected void
registerBaseBindings()
Register the basic bindings into the container.
at line 279
protected void
registerBaseServiceProviders()
Register all of the base service providers.
at line 304
void
bootstrapWith(array $bootstrappers)
Run the given array of bootstrap classes.
at line 320
void
beforeBootstrapping(string $bootstrapper, Closure $callback)
Register a callback to run before a bootstrapper.
at line 328
void
afterBootstrapping(string $bootstrapper, Closure $callback)
Register a callback to run after a bootstrapper.
at line 336
void
afterLoadingEnvironment(Closure $callback)
Register a callback to run after loading the environment.
at line 347
bool
hasBeenBootstrapped()
Determine if the application has been bootstrapped before.
at line 360
Application
setBasePath(string $basePath)
Set the base path for the application.
Boot-only. Rebinds path instances on the singleton container; runtime use races across coroutines and breaks every concurrent path resolution.
at line 372
protected void
bindPathsInContainer()
Bind all of the application paths in the container.
at line 394
string
path(string $path = '')
Get the path to the application "app" directory.
at line 405
Application
useAppPath(string $path)
Set the application directory.
Boot-only. The configured path and its container binding are shared by every request in the worker.
at line 417
string
basePath(string $path = '')
Get the base path of the Hypervel installation.
at line 425
string
bootstrapPath(string $path = '')
Get the path to the bootstrap directory.
at line 436
Application
useBootstrapPath(string $path)
Set the bootstrap file directory.
Boot-only. The configured path and its container binding are shared by every request in the worker.
at line 448
string
getBootstrapProvidersPath()
Get the path to the service provider list in the bootstrap directory.
at line 456
string
configPath(string $path = '')
Get the path to the application configuration files.
at line 467
Application
useConfigPath(string $path)
Set the configuration directory.
Boot-only. The configured path and its container binding are shared by every request in the worker.
at line 479
string
databasePath(string $path = '')
Get the path to the database directory.
at line 490
Application
useDatabasePath(string $path)
Set the database directory.
Boot-only. The configured path and its container binding are shared by every request in the worker.
at line 502
string
langPath(string $path = '')
Get the path to the language files.
at line 513
Application
useLangPath(string $path)
Set the language file directory.
Boot-only. The configured path and its container binding are shared by every request in the worker.
at line 525
string
publicPath(string $path = '')
Get the path to the public directory.
at line 536
Application
usePublicPath(string $path)
Set the public / web directory.
Boot-only. The configured path and its container binding are shared by every request in the worker.
at line 548
string
resourcePath(string $path = '')
Get the path to the resources directory.
at line 558
string
viewPath(string $path = '')
Get the path to the views directory.
This method returns the first configured path in the array of view paths.
at line 573
string
storagePath(string $path = '')
Get the path to the storage directory.
at line 592
Application
useStoragePath(string $path)
Set the storage directory.
Boot-only. The configured path and its container binding are shared by every request in the worker.
at line 604
string|null
environmentPath()
Get the path to the environment file directory.
at line 616
Application
useEnvironmentPath(string $path)
Set the directory for the environment file.
Boot-only. The configured path is shared by every request in the worker.
at line 631
Application
loadEnvironmentFrom(string $file)
Set the environment file to be loaded during bootstrapping.
Boot-only. The configured filename is shared by every request in the worker.
at line 641
string
environmentFile()
Get the environment file the application is using.
at line 649
string
environmentFilePath()
Get the fully qualified path to the environment file.
at line 657
bool
configurationIsCached()
Determine if the application configuration is cached.
at line 665
string
getCachedConfigPath()
Get the path to the configuration cache file.
at line 673
string
getCachedPackagesPath()
Get the path to the cached packages.php file.
at line 681
bool
routesAreCached()
Determine if the application routes are cached.
at line 689
string
getCachedRoutesPath()
Get the path to the routes cache file.
at line 697
bool
eventsAreCached()
Determine if the application events are cached.
at line 705
string
getCachedEventsPath()
Get the path to the events cache file.
at line 713
protected string
normalizeCachePath(string $key, string $default)
Normalize a relative or absolute path to a cache file.
at line 732
Application
addAbsoluteCachePathPrefix(string $prefix)
Add new prefix to list of absolute path prefixes.
Boot-only. The prefix persists on the application singleton and affects cache-path resolution for every request in the worker.
at line 742
string
joinPaths(string|null $basePath, string $path = '')
Join the given paths together.
at line 750
bool|string
environment(array|string ...$environments)
Get or check the current application environment.
at line 764
bool
isLocal()
Determine if the application is in the local environment.
at line 772
bool
isProduction()
Determine if the application is in the production environment.
at line 780
string
detectEnvironment(Closure $callback)
Detect the application's current environment.
at line 796
bool
runningInConsole()
Determine if the application is running in the console.
In Swoole, PHP_SAPI is always 'cli', so this defaults to true. The server command sets it to false before starting the HTTP server, and workers inherit that value.
at line 808
bool
runningConsoleCommand(string|array ...$commands)
Determine if the application is running any of the given console commands.
at line 828
void
setRunningInConsole(bool $runningInConsole)
Set whether the application is running in the console.
Boot-only. The flag persists on the singleton Application for the worker lifetime and is read by every runningInConsole() check across all coroutines.
at line 836
bool
runningUnitTests()
Determine if the application is running unit tests.
at line 844
bool
hasDebugModeEnabled()
Determine if the application is running with debug mode enabled.
at line 852
MaintenanceMode
maintenanceMode()
Get an instance of the maintenance mode manager implementation.
at line 860
bool
isDownForMaintenance()
Determine if the application is currently down for maintenance.
at line 868
int
handleCommand(InputInterface $input)
Handle the incoming Artisan command.
at line 885
bool
shouldMergeFrameworkConfiguration()
Determine if the framework's base configuration should be merged.
at line 898
Application
dontMergeFrameworkConfiguration()
Indicate that the framework's base configuration should not be merged.
Boot-only. The setting changes configuration bootstrap behavior for the entire worker.
at line 908
bool
shouldSkipMiddleware()
Determine if middleware has been disabled for the application.
at line 920
void
registered(callable $callback)
Register a new registered listener.
Boot-only. The callback persists in the Application's registeredCallbacks array and fires once per service provider registration during boot.
at line 933
void
registerConfiguredProviders()
Register all of the configured providers.
Providers are loaded in three tiers:
- Framework providers (Hypervel* from app.providers) — always first
- Discovered providers (from composer packages) — sorted by priority
- Application providers (non-Hypervel* from app.providers) — always last
at line 954
protected array
discoverProviders()
Discover service providers from installed composer packages.
at line 968
static protected array
sortByPriority(array $providers)
Sort providers by their priority property in descending order.
Higher priority values are loaded first. Providers with the same priority preserve their original order (stable sort).
at line 994
ServiceProvider
register(ServiceProvider|string $provider, bool $force = false)
Register a service provider with the application.
at line 1048
ServiceProvider|null
getProvider(ServiceProvider|string $provider)
Get the registered service provider instance if it exists.
at line 1058
array
getProviders(ServiceProvider|string $provider)
Get the registered service provider instances if any exist.
at line 1068
ServiceProvider
resolveProvider(string $provider)
Resolve a service provider instance from the class name.
at line 1076
protected void
markAsRegistered(ServiceProvider $provider)
Mark the given provider as registered.
at line 1088
bool
isBooted()
Determine if the application has booted.
at line 1096
void
boot()
Boot the application's service providers.
at line 1119
protected void
bootProvider(ServiceProvider $provider)
Boot the given service provider.
at line 1137
void
booting(callable $callback)
Register a new boot listener.
Boot-only. The callback fires once during application boot; runtime use after boot stores the closure on the singleton Application with no future boot to listen for.
at line 1149
void
booted(callable $callback)
Register a new "booted" listener.
Boot-only. If the app has already booted, the callback fires immediately and is never invoked again, but remains stored on the singleton Application for the worker lifetime.
at line 1168
Application
terminating(callable|string $callback)
Register a terminating callback with the application.
Boot-only. Callbacks persist for the worker's lifetime and fire on every subsequent request — per-request use leaks the closure and anything it captures across every request the worker handles. Use defer() for per-request "after the response" cleanup.
at line 1178
void
terminate()
Terminate the application.
at line 1200
protected void
fireAppCallbacks(array $callbacks)
Call the booting callbacks for the application.
at line 1217
never
abort(int $code, string $message = '', array $headers = [])
Throw an HttpException with the given data.
at line 1231
array
getLoadedProviders()
Get the service providers that have been loaded.
at line 1239
bool
providerIsLoaded(string $provider)
Determine if the given service provider is loaded.
at line 1247
string
getLocale()
Get the current application locale.
at line 1255
bool
isLocale(string $locale)
Determine if the application locale is the given locale.
at line 1263
string
currentLocale()
Get the current application locale.
at line 1271
string
getFallbackLocale()
Get the current application fallback locale.
at line 1279
void
setLocale(string $locale)
Set the current application locale.
at line 1294
void
setFallbackLocale(string $fallbackLocale)
Set the current application fallback locale.
Boot-only. The fallback is stored on the shared translator and affects every request in the worker.
at line 1314
protected void
registerCoreContainerAliases()
Register the core class aliases in the container.
Keys are canonical string binding names (matching Laravel). Values are class/interface aliases that resolve to the same binding. When code calls make(SomeClass::class), getAlias() maps it to the string key, which finds the service provider's binding.
IMPORTANT: When a service has a string binding (via singleton/bind in a service provider), its concrete and contract classes MUST be listed here as aliases. Hypervel's container auto-singletons unbound concrete classes — if a class isn't aliased to its string key, make(Class::class) bypasses the string binding and creates a separate cached instance, resulting in two instances of the same service in the container.
at line 1512
string
getNamespace()
Get the application namespace.