interface Application implements Container

Methods

mixed
get(string $id)

No description

bool
bound(string $abstract)

Determine if the given abstract type has been bound.

void
alias(string $abstract, string $alias)

Alias a type to a different name.

void
tag(array|string $abstracts, array|string $tags)

Assign a set of tags to a given binding.

iterable
tagged(string $tag)

Resolve all of the bindings for a given tag.

void
bind(Closure|string $abstract, Closure|string|null $concrete = null, bool $shared = false)

Register a binding with the container.

void
bindMethod(array|string $method, Closure $callback)

Bind a callback to resolve with Container::call.

void
bindIf(Closure|string $abstract, Closure|string|null $concrete = null, bool $shared = false)

Register a binding if it hasn't already been registered.

void
singleton(Closure|string $abstract, Closure|string|null $concrete = null)

Register a shared binding in the container.

void
singletonIf(Closure|string $abstract, Closure|string|null $concrete = null)

Register a shared binding if it hasn't already been registered.

void
scoped(Closure|string $abstract, Closure|string|null $concrete = null)

Register a scoped binding in the container.

void
scopedIf(Closure|string $abstract, Closure|string|null $concrete = null)

Register a scoped binding if it hasn't already been registered.

void
extend(string $abstract, Closure $closure)

"Extend" an abstract type in the container.

mixed
instance(string $abstract, mixed $instance)

Register an existing instance as shared in the container.

void
forgetInstance(string $abstract)

Remove a resolved instance from the instance cache.

void
addContextualBinding(string $concrete, string $abstract, mixed $implementation)

Add a contextual binding to the container.

when(string|array $concrete)

Define a contextual binding.

factory(string $abstract)

Get a closure to resolve the given type from the container.

void
flush()

Flush the container of all bindings and resolved instances.

mixed
make(string $abstract, array $parameters = [])

Resolve the given type from the container.

mixed
build(Closure|string $concrete)

Instantiate a concrete instance of the given type.

mixed
buildWith(Closure|string $concrete, array $parameters = [])

Instantiate a concrete instance with the given parameter overrides.

mixed
call(callable|string $callback, array $parameters = [], string|null $defaultMethod = null)

Call the given Closure / class@method and inject its dependencies.

bool
resolved(string $abstract)

Determine if the given abstract type has been resolved.

mixed
rebinding(string $abstract, Closure $callback)

Register a new rebinding callback for an abstract type.

void
beforeResolving(Closure|string $abstract, Closure|null $callback = null)

Register a new before resolving callback.

void
resolving(Closure|string $abstract, Closure|null $callback = null)

Register a new resolving callback.

void
afterResolving(Closure|string $abstract, Closure|null $callback = null)

Register a new after resolving callback.

string
version()

Get the version number of the application.

void
bootstrapWith(array $bootstrappers)

Run the given array of bootstrap classes.

bool
hasBeenBootstrapped()

Determine if the application has been bootstrapped before.

setBasePath(string $basePath)

Set the base path for the application.

string
basePath(string $path = '')

Get the base path of the Hypervel installation.

string
bootstrapPath(string $path = '')

Get the path to the bootstrap directory.

string
path(string $path = '')

Get the path to the application "app" directory.

string
configPath(string $path = '')

Get the path to the application configuration files.

string
databasePath(string $path = '')

Get the path to the database directory.

string
langPath(string $path = '')

Get the path to the language files.

string
publicPath(string $path = '')

Get the path to the public directory.

string
resourcePath(string $path = '')

Get the path to the resources directory.

string
viewPath(string $path = '')

Get the path to the views directory.

string
storagePath(string $path = '')

Get the path to the storage directory.

bool
configurationIsCached()

Determine if the application configuration is cached.

string
getCachedConfigPath()

Get the path to the configuration cache file.

string
joinPaths(string|null $basePath, string $path = '')

Join the given paths together.

bool|string
environment(array|string ...$environments)

Get or check the current application environment.

bool
isLocal()

Determine if the application is in the local environment.

bool
isProduction()

Determine if the application is in the production environment.

string
detectEnvironment(Closure $callback)

Detect the application's current environment.

void
resolveEnvironmentUsing(callable|null $callback)

Set the callback to resolve the application's environment.

string|null
environmentPath()

Get the path to the environment file directory.

useEnvironmentPath(string $path)

Set the directory for the environment file.

loadEnvironmentFrom(string $file)

Set the environment file to be loaded during bootstrapping.

string
environmentFile()

Get the environment file the application is using.

string
environmentFilePath()

Get the fully qualified path to the environment file.

bool
runningInConsole()

Determine if the application is running in the console.

bool
runningConsoleCommand(string|array ...$commands)

Determine if the application is running any of the given console commands.

bool
runningUnitTests()

Determine if the application is running unit tests.

bool
hasDebugModeEnabled()

Determine if the application is running with debug mode enabled.

maintenanceMode()

Get an instance of the maintenance mode manager implementation.

bool
isDownForMaintenance()

Determine if the application is currently down for maintenance.

void
registerConfiguredProviders()

Register all of the configured providers.

register(ServiceProvider|string $provider, bool $force = false)

Register a service provider with the application.

array
getProviders(ServiceProvider|string $provider)

Get the registered service provider instances if any exist.

resolveProvider(string $provider)

Resolve a service provider instance from the class name.

bool
isBooted()

Determine if the application has booted.

void
boot()

Boot the application's service providers.

void
booting(callable $callback)

Register a new boot listener.

void
booted(callable $callback)

Register a new "booted" listener.

never
abort(int $code, string $message = '', array $headers = [])

Throw an HttpException with the given data.

array
getLoadedProviders()

Get the service providers that have been loaded.

bool
providerIsLoaded(string $provider)

Determine if the given service provider is loaded.

string
getLocale()

Get the current application locale.

bool
isLocale(string $locale)

Determine if the application locale is the given locale.

string
currentLocale()

Get the current application locale.

string
getFallbackLocale()

Get the current application fallback locale.

void
setLocale(string $locale)

Set the current application locale.

bool
routesAreCached()

Determine if the application routes are cached.

string
getCachedRoutesPath()

Get the path to the routes cache file.

bool
eventsAreCached()

Determine if the application events are cached.

string
getCachedEventsPath()

Get the path to the events cache file.

string
getCachedPackagesPath()

Get the path to the cached packages.php file.

bool
shouldMergeFrameworkConfiguration()

Determine if the framework's base configuration should be merged.

bool
shouldSkipMiddleware()

Determine if middleware has been disabled for the application.

terminating(callable|string $callback)

Register a terminating callback with the application.

void
terminate()

Terminate the application.

string
getNamespace()

Get the application namespace.

Details

in Container at line 21
mixed get(string $id)

No description

Parameters

string $id

Return Value

mixed

in Container at line 26
bool bound(string $abstract)

Determine if the given abstract type has been bound.

Parameters

string $abstract

Return Value

bool

in Container at line 33
void alias(string $abstract, string $alias)

Alias a type to a different name.

Parameters

string $abstract
string $alias

Return Value

void

Exceptions

LogicException

in Container at line 38
void tag(array|string $abstracts, array|string $tags)

Assign a set of tags to a given binding.

Parameters

array|string $abstracts
array|string $tags

Return Value

void

in Container at line 43
iterable tagged(string $tag)

Resolve all of the bindings for a given tag.

Parameters

string $tag

Return Value

iterable

in Container at line 48
void bind(Closure|string $abstract, Closure|string|null $concrete = null, bool $shared = false)

Register a binding with the container.

Parameters

Closure|string $abstract
Closure|string|null $concrete
bool $shared

Return Value

void

in Container at line 53
void bindMethod(array|string $method, Closure $callback)

Bind a callback to resolve with Container::call.

Parameters

array|string $method
Closure $callback

Return Value

void

in Container at line 58
void bindIf(Closure|string $abstract, Closure|string|null $concrete = null, bool $shared = false)

Register a binding if it hasn't already been registered.

Parameters

Closure|string $abstract
Closure|string|null $concrete
bool $shared

Return Value

void

in Container at line 63
void singleton(Closure|string $abstract, Closure|string|null $concrete = null)

Register a shared binding in the container.

Parameters

Closure|string $abstract
Closure|string|null $concrete

Return Value

void

in Container at line 68
void singletonIf(Closure|string $abstract, Closure|string|null $concrete = null)

Register a shared binding if it hasn't already been registered.

Parameters

Closure|string $abstract
Closure|string|null $concrete

Return Value

void

in Container at line 73
void scoped(Closure|string $abstract, Closure|string|null $concrete = null)

Register a scoped binding in the container.

Parameters

Closure|string $abstract
Closure|string|null $concrete

Return Value

void

in Container at line 78
void scopedIf(Closure|string $abstract, Closure|string|null $concrete = null)

Register a scoped binding if it hasn't already been registered.

Parameters

Closure|string $abstract
Closure|string|null $concrete

Return Value

void

in Container at line 85
void extend(string $abstract, Closure $closure)

"Extend" an abstract type in the container.

Parameters

string $abstract
Closure $closure

Return Value

void

Exceptions

InvalidArgumentException

in Container at line 95
mixed instance(string $abstract, mixed $instance)

Register an existing instance as shared in the container.

Parameters

string $abstract
mixed $instance

Return Value

mixed

in Container at line 100
void forgetInstance(string $abstract)

Remove a resolved instance from the instance cache.

Parameters

string $abstract

Return Value

void

in Container at line 105
void addContextualBinding(string $concrete, string $abstract, mixed $implementation)

Add a contextual binding to the container.

Parameters

string $concrete
string $abstract
mixed $implementation

Return Value

void

in Container at line 110
ContextualBindingBuilder when(string|array $concrete)

Define a contextual binding.

Parameters

string|array $concrete

Return Value

ContextualBindingBuilder

in Container at line 120
Closure factory(string $abstract)

Get a closure to resolve the given type from the container.

Parameters

string $abstract

Return Value

Closure

in Container at line 125
void flush()

Flush the container of all bindings and resolved instances.

Return Value

void

in Container at line 137
mixed make(string $abstract, array $parameters = [])

Resolve the given type from the container.

Parameters

string $abstract
array $parameters

Return Value

mixed

Exceptions

BindingResolutionException

in Container at line 147
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.

Parameters

Closure|string $concrete

Return Value

mixed

Exceptions

BindingResolutionException

in Container at line 157
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.

Parameters

Closure|string $concrete
array $parameters

Return Value

mixed

Exceptions

BindingResolutionException

in Container at line 162
mixed call(callable|string $callback, array $parameters = [], string|null $defaultMethod = null)

Call the given Closure / class@method and inject its dependencies.

Parameters

callable|string $callback
array $parameters
string|null $defaultMethod

Return Value

mixed

in Container at line 167
bool resolved(string $abstract)

Determine if the given abstract type has been resolved.

Parameters

string $abstract

Return Value

bool

in Container at line 172
mixed rebinding(string $abstract, Closure $callback)

Register a new rebinding callback for an abstract type.

Parameters

string $abstract
Closure $callback

Return Value

mixed

in Container at line 177
void beforeResolving(Closure|string $abstract, Closure|null $callback = null)

Register a new before resolving callback.

Parameters

Closure|string $abstract
Closure|null $callback

Return Value

void

in Container at line 182
void resolving(Closure|string $abstract, Closure|null $callback = null)

Register a new resolving callback.

Parameters

Closure|string $abstract
Closure|null $callback

Return Value

void

in Container at line 187
void afterResolving(Closure|string $abstract, Closure|null $callback = null)

Register a new after resolving callback.

Parameters

Closure|string $abstract
Closure|null $callback

Return Value

void

at line 19
string version()

Get the version number of the application.

Return Value

string

at line 24
void bootstrapWith(array $bootstrappers)

Run the given array of bootstrap classes.

Parameters

array $bootstrappers

Return Value

void

at line 29
bool hasBeenBootstrapped()

Determine if the application has been bootstrapped before.

Return Value

bool

at line 36
Application setBasePath(string $basePath)

Set the base path for the application.

Parameters

string $basePath

Return Value

Application

at line 41
string basePath(string $path = '')

Get the base path of the Hypervel installation.

Parameters

string $path

Return Value

string

at line 46
string bootstrapPath(string $path = '')

Get the path to the bootstrap directory.

Parameters

string $path

Return Value

string

at line 51
string path(string $path = '')

Get the path to the application "app" directory.

Parameters

string $path

Return Value

string

at line 56
string configPath(string $path = '')

Get the path to the application configuration files.

Parameters

string $path

Return Value

string

at line 61
string databasePath(string $path = '')

Get the path to the database directory.

Parameters

string $path

Return Value

string

at line 66
string langPath(string $path = '')

Get the path to the language files.

Parameters

string $path

Return Value

string

at line 71
string publicPath(string $path = '')

Get the path to the public directory.

Parameters

string $path

Return Value

string

at line 76
string resourcePath(string $path = '')

Get the path to the resources directory.

Parameters

string $path

Return Value

string

at line 83
string viewPath(string $path = '')

Get the path to the views directory.

This method returns the first configured path in the array of view paths.

Parameters

string $path

Return Value

string

at line 88
string storagePath(string $path = '')

Get the path to the storage directory.

Parameters

string $path

Return Value

string

at line 93
bool configurationIsCached()

Determine if the application configuration is cached.

Return Value

bool

at line 98
string getCachedConfigPath()

Get the path to the configuration cache file.

Return Value

string

at line 103
string joinPaths(string|null $basePath, string $path = '')

Join the given paths together.

Parameters

string|null $basePath
string $path

Return Value

string

at line 108
bool|string environment(array|string ...$environments)

Get or check the current application environment.

Parameters

array|string ...$environments

Return Value

bool|string

at line 113
bool isLocal()

Determine if the application is in the local environment.

Return Value

bool

at line 118
bool isProduction()

Determine if the application is in the production environment.

Return Value

bool

at line 123
string detectEnvironment(Closure $callback)

Detect the application's current environment.

Parameters

Closure $callback

Return Value

string

at line 128
void resolveEnvironmentUsing(callable|null $callback)

Set the callback to resolve the application's environment.

Parameters

callable|null $callback

Return Value

void

at line 133
string|null environmentPath()

Get the path to the environment file directory.

Return Value

string|null

at line 140
Application useEnvironmentPath(string $path)

Set the directory for the environment file.

Parameters

string $path

Return Value

Application

at line 147
Application loadEnvironmentFrom(string $file)

Set the environment file to be loaded during bootstrapping.

Parameters

string $file

Return Value

Application

at line 152
string environmentFile()

Get the environment file the application is using.

Return Value

string

at line 157
string environmentFilePath()

Get the fully qualified path to the environment file.

Return Value

string

at line 165
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.

Return Value

bool

at line 170
bool runningConsoleCommand(string|array ...$commands)

Determine if the application is running any of the given console commands.

Parameters

string|array ...$commands

Return Value

bool

at line 175
bool runningUnitTests()

Determine if the application is running unit tests.

Return Value

bool

at line 180
bool hasDebugModeEnabled()

Determine if the application is running with debug mode enabled.

Return Value

bool

at line 185
MaintenanceMode maintenanceMode()

Get an instance of the maintenance mode manager implementation.

Return Value

MaintenanceMode

at line 190
bool isDownForMaintenance()

Determine if the application is currently down for maintenance.

Return Value

bool

at line 195
void registerConfiguredProviders()

Register all of the configured providers.

Return Value

void

at line 200
ServiceProvider register(ServiceProvider|string $provider, bool $force = false)

Register a service provider with the application.

Parameters

ServiceProvider|string $provider
bool $force

Return Value

ServiceProvider

at line 205
array getProviders(ServiceProvider|string $provider)

Get the registered service provider instances if any exist.

Parameters

ServiceProvider|string $provider

Return Value

array

at line 210
ServiceProvider resolveProvider(string $provider)

Resolve a service provider instance from the class name.

Parameters

string $provider

Return Value

ServiceProvider

at line 215
bool isBooted()

Determine if the application has booted.

Return Value

bool

at line 220
void boot()

Boot the application's service providers.

Return Value

void

at line 225
void booting(callable $callback)

Register a new boot listener.

Parameters

callable $callback

Return Value

void

at line 230
void booted(callable $callback)

Register a new "booted" listener.

Parameters

callable $callback

Return Value

void

at line 238
never abort(int $code, string $message = '', array $headers = [])

Throw an HttpException with the given data.

Parameters

int $code
string $message
array $headers

Return Value

never

Exceptions

HttpException
NotFoundHttpException

at line 245
array getLoadedProviders()

Get the service providers that have been loaded.

Return Value

array

at line 250
bool providerIsLoaded(string $provider)

Determine if the given service provider is loaded.

Parameters

string $provider

Return Value

bool

at line 255
string getLocale()

Get the current application locale.

Return Value

string

at line 260
bool isLocale(string $locale)

Determine if the application locale is the given locale.

Parameters

string $locale

Return Value

bool

at line 265
string currentLocale()

Get the current application locale.

Return Value

string

at line 270
string getFallbackLocale()

Get the current application fallback locale.

Return Value

string

at line 275
void setLocale(string $locale)

Set the current application locale.

Parameters

string $locale

Return Value

void

at line 280
bool routesAreCached()

Determine if the application routes are cached.

Return Value

bool

at line 285
string getCachedRoutesPath()

Get the path to the routes cache file.

Return Value

string

at line 290
bool eventsAreCached()

Determine if the application events are cached.

Return Value

bool

at line 295
string getCachedEventsPath()

Get the path to the events cache file.

Return Value

string

at line 300
string getCachedPackagesPath()

Get the path to the cached packages.php file.

Return Value

string

at line 305
bool shouldMergeFrameworkConfiguration()

Determine if the framework's base configuration should be merged.

Return Value

bool

at line 310
bool shouldSkipMiddleware()

Determine if middleware has been disabled for the application.

Return Value

bool

at line 317
Application terminating(callable|string $callback)

Register a terminating callback with the application.

Parameters

callable|string $callback

Return Value

Application

at line 322
void terminate()

Terminate the application.

Return Value

void

at line 329
string getNamespace()

Get the application namespace.

Return Value

string

Exceptions

RuntimeException