Skip to content

Application

  • Full name: \Codefy\Framework\Application
  • Parent class: Container
  • This class is marked as final and can't be subclassed
  • This class is a Final class

Constants

Constant Visibility Type Value
APP_VERSION public '3.0.0-rc.2'
MIN_PHP_VERSION public '8.4'
DS public \DIRECTORY_SEPARATOR

Properties

APP

The current globally available Application (if any).

public static ?self $APP
  • This property is static.

charset

public string $charset

language

public string $language

locale

public string $locale

controllerNamespace

public string $controllerNamespace

ROOT_PATH

public static string $ROOT_PATH
  • This property is static.

encryptedEnv

public static bool $encryptedEnv
  • This property is static.

basePath

private string $basePath

appPath

private ?string $appPath

serviceProviders

private array $serviceProviders

serviceProvidersRegistered

private array $serviceProvidersRegistered

baseMiddlewares

private array $baseMiddlewares

booted

public bool $booted

hasBeenBootstrapped

private bool $hasBeenBootstrapped

bootingCallbacks

private array $bootingCallbacks

bootedCallbacks

private array $bootedCallbacks

registeredCallbacks

private array $registeredCallbacks

param

private array $param

request

public \Psr\Http\Message\ServerRequestInterface $request

response

public \Psr\Http\Message\ResponseInterface $response

assets

public \Codefy\Framework\Support\Assets $assets

mailer

public \Qubus\Mail\Mailer $mailer

session

public \Qubus\Http\Session\PhpSession $session

flash

public \Qubus\Http\Session\Flash $flash

event

public \Psr\EventDispatcher\EventDispatcherInterface $event

httpCookie

public \Qubus\Http\Cookies\Factory\HttpCookieFactory $httpCookie

localStorage

public \Codefy\Framework\Support\LocalStorage $localStorage

configContainer

public \Qubus\Config\ConfigContainer $configContainer

pipeline

public \Codefy\Framework\Pipeline\PipelineBuilder $pipeline

hook

public \Qubus\EventDispatcher\ActionFilter\Observer $hook

string

public \Qubus\Support\StringHelper $string

array

public \Qubus\Support\ArrayHelper $array

router

public \Qubus\Routing\Router $router

path

public \Codefy\Framework\Support\Paths $path

Methods

__construct

public __construct(array $params = []): mixed

Parameters:

Parameter Type Description
$params array

Throws:


registerBaseBindings

private registerBaseBindings(): void

inferBasePath

Infer the application's base directory from the environment and server.

protected static inferBasePath(): string|null
  • This method is static.

getDbConnection

public getDbConnection(): \Qubus\Expressive\Connection

Throws:


getDb

public getDb(): \Qubus\Expressive\QueryBuilder|null

Throws:


version

Return the version of the Application's Framework.

public version(): string

singleton

Ensure a value or object will remain globally unique.

public singleton(string $key, callable $value): \Codefy\Framework\Application

Parameters:

Parameter Type Description
$key string The value or object name
$value callable The closure that defines the object

registerDefaultServiceProviders

protected registerDefaultServiceProviders(): void

Throws:


bootstrapWith

public bootstrapWith(array $bootstrappers): void

Parameters:

Parameter Type Description
$bootstrappers array

getContainer

public getContainer(): \Qubus\Injector\ServiceContainer|\Psr\Container\ContainerInterface

setBooted

public setBooted(bool $bool = false): void

Parameters:

Parameter Type Description
$bool bool

boot

public boot(): void

Throws:


forceRegisterServiceProvider

Force register a service provider with the application.

public forceRegisterServiceProvider(string|\Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable $provider): \Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable

Parameters:

Parameter Type Description
$provider string|\Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable

Throws:


registerConfiguredServiceProviders

Register all configured providers.

public registerConfiguredServiceProviders(): void

Throws:


registerServiceProvider

Register a Service Provider to the application.

public registerServiceProvider(string|\Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable $serviceProvider, bool $force = false): \Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable|string

Parameters:

Parameter Type Description
$serviceProvider string|\Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable
$force bool

Throws:


getRegisteredServiceProvider

Get the registered service provider instance if it exists.

public getRegisteredServiceProvider(\Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable|string $provider): \Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable|null

Parameters:

Parameter Type Description
$provider \Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable|string

forgetServiceProvider

Forget the ServiceProvider from the application.

public forgetServiceProvider(string|\Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable $serviceProvider): void

Parameters:

Parameter Type Description
$serviceProvider string|\Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable

resolveServiceProvider

Resolve a service provider instance from the class name.

public resolveServiceProvider(string $provider): \Qubus\Injector\ServiceProvider\BaseServiceProvider

Parameters:

Parameter Type Description
$provider string

getRegisteredProviders

Get the service providers that have been registered.

public getRegisteredProviders(): array<string,bool>

providerIsRegistered

Determine if the given service provider is registered.

public providerIsRegistered(string|\Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable $provider): bool

Parameters:

Parameter Type Description
$provider string|\Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable

bootServiceProvider

Boot the given service provider.

protected bootServiceProvider(\Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable $provider): void

Parameters:

Parameter Type Description
$provider \Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable

Throws:


booting

Register a new boot listener.

public booting(callable $callback): void

Parameters:

Parameter Type Description
$callback callable

booted

Register a new "booted" listener.

public booted(callable $callback): void

Parameters:

Parameter Type Description
$callback callable

fireAppCallbacks

Call the booting callbacks for the application.

protected fireAppCallbacks(callable[]& $callbacks): void

Parameters:

Parameter Type Description
$callbacks callable[]

markServiceProviderAsRegistered

Mark the particular ServiceProvider as having been registered.

protected markServiceProviderAsRegistered(\Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable $serviceProvider): void

Parameters:

Parameter Type Description
$serviceProvider \Qubus\Injector\ServiceProvider\Serviceable|\Qubus\Injector\ServiceProvider\Bootable

hasBeenBootstrapped

Determine if the application has been bootstrapped before.

public hasBeenBootstrapped(): bool

withBasePath

Set the Application's base directory.

public withBasePath(string $basePath): mixed

Parameters:

Parameter Type Description
$basePath string

bindPathsToContainer

protected bindPathsToContainer(): void

withAppPath

Set the Application's "app" directory.

public withAppPath(string $appPath): self

Parameters:

Parameter Type Description
$appPath string

path

Get the path to the application's "app" directory.

public path(): string

basePath

Get the Application's base directory.

public basePath(): string

bootStrapPath

Get the path to the application's "bootstrap" directory.

public bootStrapPath(): string

getBootstrapProvidersPath

Get the path to the service provider list in the bootstrap directory.

public getBootstrapProvidersPath(): string

configPath

Get the path to the application's "config" directory.

public configPath(): string

databasePath

Get the path to the application's "database" directory.

public databasePath(): string

localePath

Get the path to the application's "locale" directory.

public localePath(): string

publicPath

Get the path to the application's "public" directory.

public publicPath(): string

storagePath

Get the path to the application's "storage" directory.

public storagePath(): string

resourcePath

Get the path to the application's "resources" directory.

public resourcePath(): string

viewPath

Get the path to the application's "view" directory.

public viewPath(): string

withLocale

public withLocale(string $locale): void

Parameters:

Parameter Type Description
$locale string

getLocale

public getLocale(): string

withControllerNamespace

public withControllerNamespace(string $namespace): void

Parameters:

Parameter Type Description
$namespace string

withBaseMiddlewares

public withBaseMiddlewares(array $middlewares): void

Parameters:

Parameter Type Description
$middlewares array

getBaseMiddlewares

public getBaseMiddlewares(): array

Throws:


isRunningInConsole

public isRunningInConsole(): bool

hasDebugModeEnabled

Determine if the application is running with debug mode enabled.

public hasDebugModeEnabled(): bool

Throws:


registered

Register a new callable function.

public registered(callable $callback): void

Parameters:

Parameter Type Description
$callback callable

coreAliases

protected coreAliases(): array

handle

public handle(\Psr\Http\Message\ServerRequestInterface $request): \Psr\Http\Message\ResponseInterface

Parameters:

Parameter Type Description
$request \Psr\Http\Message\ServerRequestInterface

Throws:


handleRequest

public handleRequest(?\Psr\Http\Message\ServerRequestInterface $request = null): void

Parameters:

Parameter Type Description
$request ?\Psr\Http\Message\ServerRequestInterface

loadEnvironment

Load environment file(s).

private static loadEnvironment(string $basePath): void
  • This method is static.

Parameters:

Parameter Type Description
$basePath string

Throws:


__get

public __get(mixed $name): mixed

Parameters:

Parameter Type Description
$name mixed

__isset

public __isset(mixed $name): bool

Parameters:

Parameter Type Description
$name mixed

__set

public __set(mixed $name, mixed $value): void

Parameters:

Parameter Type Description
$name mixed
$value mixed

__unset

public __unset(mixed $name): void

Parameters:

Parameter Type Description
$name mixed

__destruct

public __destruct(): mixed

isProduction

Determine if the application is in production.

public isProduction(): bool

isDevelopment

Determine if the application is in development.

public isDevelopment(): bool

create

Create a new CodefyPHP application instance.

public static create(array $config): \Codefy\Framework\Configuration\ApplicationBuilder
  • This method is static.

Parameters:

Parameter Type Description
$config array

Throws:


getInstance

Get the globally available instance of the container.

public static getInstance(?string $path = null): static
  • This method is static.

Parameters:

Parameter Type Description
$path ?string

Throws:


Inherited methods

getLogger

FileLogger

public static getLogger(): \Psr\Log\LoggerInterface
  • This method is static.

Throws:


getSmtpLogger

FileLogger with SMTP support.

public static getSmtpLogger(): \Psr\Log\LoggerInterface
  • This method is static.

Throws:



Automatically generated on 2025-10-13