Application
interface Application implements Container
Methods
Assign a set of tags to a given binding.
Register a binding with the container.
Bind a callback to resolve with Container::call.
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.
Determine if the object is a resolved scoped instance in this coroutine.
Determine if the container holds a worker-shared instance for the given type.
Register an existing instance as shared in the container.
Remove a resolved instance from the instance cache.
Add a contextual binding to the container.
Get a closure to resolve the given type from the container.
Resolve the given type from the container.
Resolve the given type with a transient implicit lifetime.
Instantiate a concrete instance with the given parameter overrides.
Resolve the contextual constructor parameters of a class within its build context.
Call the given Closure / class@method and inject its dependencies.
Determine if the given abstract type has been resolved.
Register a new rebinding callback for an abstract type.
Register a new before resolving callback.
Register a new resolving callback.
Register a new after resolving callback.
Get the version number of the application.
Run the given array of bootstrap classes.
Determine if the application has been bootstrapped before.
Set the base path for the application.
Get the base path of the Hypervel installation.
Get the path to the bootstrap directory.
Get the path to the application "app" directory.
Get the path to the application configuration files.
Get the path to the database directory.
Get the path to the language files.
Get the path to the public directory.
Get the path to the resources directory.
Get the path to the views directory.
Get the path to the storage directory.
Determine if the application configuration is cached.
Get the path to the configuration cache file.
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.
Set the callback to resolve the application's environment.
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 is running in the console.
Determine if the application is running any of the given console commands.
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.
Register all of the configured providers.
Register a service provider with the application.
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.
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.
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.
Get the path to the cached packages.php file.
Determine if the framework's base configuration should be merged.
Determine if middleware has been disabled for the application.
Register a terminating callback with the application.
Terminate the application.
Get the application namespace.
Details
in
Container at line 23
mixed
get(string $id)
No description
in
Container at line 28
bool
bound(string $abstract)
Determine if the given abstract type has been bound.
in
Container at line 35
void
alias(string $abstract, string $alias)
Alias a type to a different name.
in
Container at line 41
void
tag(array|string $abstracts, array|string $tags)
Assign a set of tags to a given binding.
in
Container at line 47
iterable
tagged(string $tag)
Resolve all of the bindings for a given tag.
in
Container at line 52
void
bind(Closure|string $abstract, Closure|string|null $concrete = null, bool $shared = false)
Register a binding with the container.
in
Container at line 58
void
bindMethod(array|string $method, Closure $callback)
Bind a callback to resolve with Container::call.
in
Container at line 64
void
bindIf(Closure|string $abstract, Closure|string|null $concrete = null, bool $shared = false)
Register a binding if it hasn't already been registered.
in
Container at line 70
void
singleton(Closure|string $abstract, Closure|string|null $concrete = null)
Register a shared binding in the container.
in
Container at line 76
void
singletonIf(Closure|string $abstract, Closure|string|null $concrete = null)
Register a shared binding if it hasn't already been registered.
in
Container at line 82
void
scoped(Closure|string $abstract, Closure|string|null $concrete = null)
Register a scoped binding in the container.
in
Container at line 88
void
scopedIf(Closure|string $abstract, Closure|string|null $concrete = null)
Register a scoped binding if it hasn't already been registered.
in
Container at line 94
bool
isScoped(string $abstract)
Determine if a given abstract is a scoped binding.
in
Container at line 99
bool
isScopedInstance(mixed $instance)
Determine if the object is a resolved scoped instance in this coroutine.
in
Container at line 104
bool
resolvedShared(string $abstract)
Determine if the container holds a worker-shared instance for the given type.
in
Container at line 111
void
extend(string $abstract, Closure $closure)
"Extend" an abstract type in the container.
in
Container at line 122
mixed
instance(string $abstract, mixed $instance)
Register an existing instance as shared in the container.
in
Container at line 128
void
forgetInstance(string $abstract)
Remove a resolved instance from the instance cache.
in
Container at line 134
void
addContextualBinding(string $concrete, string $abstract, mixed $implementation)
Add a contextual binding to the container.
in
Container at line 140
ContextualBindingBuilder
when(string|array $concrete)
Define a contextual binding.
in
Container at line 150
Closure
factory(string $abstract)
Get a closure to resolve the given type from the container.
in
Container at line 155
void
flush()
Flush the container of all bindings and resolved instances.
in
Container at line 168
mixed
make(string $abstract, array $parameters = [])
Resolve the given type from the container.
in
Container at line 182
mixed
makeTransient(string $abstract)
Resolve the given type with a transient implicit lifetime.
Explicit lifetimes remain authoritative.
in
Container at line 192
mixed
build(Closure|string $concrete)
Instantiate a concrete instance of the given type.
Unlike make(), this always creates a fresh instance — it bypasses bindings, aliases, and singleton/auto-singleton caching.
in
Container at line 202
mixed
buildWith(Closure|string $concrete, array $parameters = [])
Instantiate a concrete instance with the given parameter overrides.
Unlike make(), this always creates a fresh instance — it bypasses bindings, aliases, and singleton/auto-singleton caching.
in
Container at line 217
array
resolveContextualParameters(string $concrete, array|null $names = null)
Resolve the contextual constructor parameters of a class within its build context.
Pass the values to buildWith() as overrides so they are not resolved again. Variadic parameters are skipped, because an override is passed as one argument; the container resolves them when the class is built.
in
Container at line 222
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 227
bool
resolved(string $abstract)
Determine if the given abstract type has been resolved.
in
Container at line 232
mixed
rebinding(string $abstract, Closure $callback)
Register a new rebinding callback for an abstract type.
in
Container at line 238
void
beforeResolving(Closure|string $abstract, Closure|null $callback = null)
Register a new before resolving callback.
in
Container at line 244
void
resolving(Closure|string $abstract, Closure|null $callback = null)
Register a new resolving callback.
in
Container at line 250
void
afterResolving(Closure|string $abstract, Closure|null $callback = null)
Register a new after resolving callback.
at line 21
string
version()
Get the version number of the application.
at line 26
void
bootstrapWith(array $bootstrappers)
Run the given array of bootstrap classes.
at line 31
bool
hasBeenBootstrapped()
Determine if the application has been bootstrapped before.
at line 38
Application
setBasePath(string $basePath)
Set the base path for the application.
at line 44
string
basePath(string $path = '')
Get the base path of the Hypervel installation.
at line 49
string
bootstrapPath(string $path = '')
Get the path to the bootstrap directory.
at line 54
string
path(string $path = '')
Get the path to the application "app" directory.
at line 59
string
configPath(string $path = '')
Get the path to the application configuration files.
at line 64
string
databasePath(string $path = '')
Get the path to the database directory.
at line 69
string
langPath(string $path = '')
Get the path to the language files.
at line 74
string
publicPath(string $path = '')
Get the path to the public directory.
at line 79
string
resourcePath(string $path = '')
Get the path to the resources directory.
at line 86
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 91
string
storagePath(string $path = '')
Get the path to the storage directory.
at line 96
bool
configurationIsCached()
Determine if the application configuration is cached.
at line 101
string
getCachedConfigPath()
Get the path to the configuration cache file.
at line 106
string
joinPaths(string|null $basePath, string $path = '')
Join the given paths together.
at line 111
bool|string
environment(UnitEnum|array|string ...$environments)
Get or check the current application environment.
at line 116
bool
isLocal()
Determine if the application is in the local environment.
at line 121
bool
isProduction()
Determine if the application is in the production environment.
at line 126
string
detectEnvironment(Closure $callback)
Detect the application's current environment.
at line 132
void
resolveEnvironmentUsing(callable|null $callback)
Set the callback to resolve the application's environment.
at line 138
string|null
environmentPath()
Get the path to the environment file directory.
at line 145
Application
useEnvironmentPath(string $path)
Set the directory for the environment file.
at line 153
Application
loadEnvironmentFrom(string $file)
Set the environment file to be loaded during bootstrapping.
at line 159
string
environmentFile()
Get the environment file the application is using.
at line 164
string
environmentFilePath()
Get the fully-qualified path to the environment file.
at line 172
bool
runningInConsole()
Determine if the application is running in the console.
In Swoole, PHP_SAPI is always 'cli', so the value is determined by explicit framework signals rather than SAPI detection.
at line 177
bool
runningConsoleCommand(string|array ...$commands)
Determine if the application is running any of the given console commands.
at line 182
bool
runningUnitTests()
Determine if the application is running unit tests.
at line 187
bool
hasDebugModeEnabled()
Determine if the application is running with debug mode enabled.
at line 192
MaintenanceMode
maintenanceMode()
Get an instance of the maintenance mode manager implementation.
at line 197
bool
isDownForMaintenance()
Determine if the application is currently down for maintenance.
at line 202
void
registerConfiguredProviders()
Register all of the configured providers.
at line 208
ServiceProvider
register(ServiceProvider|string $provider, bool $force = false)
Register a service provider with the application.
at line 214
array
getProviders(ServiceProvider|string $provider)
Get the registered service provider instances if any exist.
at line 219
ServiceProvider
resolveProvider(string $provider)
Resolve a service provider instance from the class name.
at line 224
bool
isBooted()
Determine if the application has booted.
at line 229
void
boot()
Boot the application's service providers.
at line 234
void
booting(callable $callback)
Register a new boot listener.
at line 240
void
booted(callable $callback)
Register a new "booted" listener.
at line 249
never
abort(int $code, string $message = '', array $headers = [])
Throw an HttpException with the given data.
at line 256
array
getLoadedProviders()
Get the service providers that have been loaded.
at line 261
bool
providerIsLoaded(string $provider)
Determine if the given service provider is loaded.
at line 266
string
getLocale()
Get the current application locale.
at line 271
bool
isLocale(string $locale)
Determine if the application locale is the given locale.
at line 276
string
currentLocale()
Get the current application locale.
at line 281
string
getFallbackLocale()
Get the current application fallback locale.
at line 286
void
setLocale(string $locale)
Set the current application locale.
at line 291
bool
routesAreCached()
Determine if the application routes are cached.
at line 296
string
getCachedRoutesPath()
Get the path to the routes cache file.
at line 301
bool
eventsAreCached()
Determine if the application events are cached.
at line 306
string
getCachedEventsPath()
Get the path to the events cache file.
at line 311
string
getCachedPackagesPath()
Get the path to the cached packages.php file.
at line 316
bool
shouldMergeFrameworkConfiguration()
Determine if the framework's base configuration should be merged.
at line 321
bool
shouldSkipMiddleware()
Determine if middleware has been disabled for the application.
at line 328
Application
terminating(callable|string $callback)
Register a terminating callback with the application.
at line 334
void
terminate()
Terminate the application.
at line 341
string
getNamespace()
Get the application namespace.