final class ApplicationContext (View source)

Carries the immutable environment, path, and debug boundaries resolved for one application bootstrap.

Methods

__construct(Environment $environment, Path $paths, DebugMode $debug)

Captures the resolved runtime values shared by HTTP and CLI infrastructure services.

Environment

Returns the normalized application environment used for runtime policy decisions.

Environment
paths()

Returns the immutable path resolver rooted at the configured application directory.

Returns the normalized debug-mode value object.

bool
debug()

Reports whether development diagnostics are enabled for this application.

bool
bool

Reports whether development diagnostics are enabled for this application.

bool
string

Returns the absolute application root established during bootstrap.

string
string
path(string $path = '')

Resolves an absolute path or an application-root-relative path without asserting containment.

string
string
appPath(string $path = '')

Resolves a path below the conventional application source directory.

string
string
configPath(string $path = '')

Resolves a path below the application configuration directory.

string
string
storagePath(string $path = '')

Resolves a path below application storage.

string
string
publicPath(string $path = '')

Resolves a path below the configured public web root.

string
string
resolveStoragePath(string $path = '')

Preserves an absolute path or resolves a relative path below application storage.

string
string
resolveWritablePath(string $path = '')

Preserves an absolute path or resolves a relative path below private writable storage.

string
string
resolveLogPath(string $path = '')

Preserves an absolute path or resolves a relative path below writable log storage.

string
string
resolveSessionPath(string $path = 'sessions')

Preserves an absolute path or composes a relative path below writable session storage.

string
string
resolveUploadPath(string $path = '')

Resolves an upload path using the public upload storage convention.

string
string
uploadPath(string $path = '')

Preserves an absolute path or resolves a relative path below the public uploads directory.

string
string
resolveCachePath(string $path = '')

Preserves an absolute path or resolves a relative path below application cache storage.

string
string
uploadRelativePath(string $path = '')

Returns a portable forward-slash path relative to the public root for an upload location.

string
bool

Reports whether production runtime behavior is active.

bool
bool

Reports whether development runtime behavior is active.

bool
bool

Reports whether testing runtime behavior is active.

bool

Details

__construct

__construct(Environment $environment, Path $paths, DebugMode $debug)

Captures the resolved runtime values shared by HTTP and CLI infrastructure services.

Parameters

Environment $environment
Path $paths
DebugMode $debug

environment

Environment environment()

Returns the normalized application environment used for runtime policy decisions.

Return Value

Environment

paths

Path paths()

Returns the immutable path resolver rooted at the configured application directory.

Return Value

Path

debugMode

DebugMode debugMode()

Returns the normalized debug-mode value object.

Return Value

DebugMode

debug

bool debug()

Reports whether development diagnostics are enabled for this application.

Return Value

bool

isDebug

bool isDebug()

Reports whether development diagnostics are enabled for this application.

Return Value

bool

basePath

string basePath()

Returns the absolute application root established during bootstrap.

Return Value

string

path

string path(string $path = '')

Resolves an absolute path or an application-root-relative path without asserting containment.

Parameters

string $path

Return Value

string

appPath

string appPath(string $path = '')

Resolves a path below the conventional application source directory.

Parameters

string $path

Return Value

string

configPath

string configPath(string $path = '')

Resolves a path below the application configuration directory.

Parameters

string $path

Return Value

string

storagePath

string storagePath(string $path = '')

Resolves a path below application storage.

Parameters

string $path

Return Value

string

publicPath

string publicPath(string $path = '')

Resolves a path below the configured public web root.

Parameters

string $path

Return Value

string

resolveStoragePath

string resolveStoragePath(string $path = '')

Preserves an absolute path or resolves a relative path below application storage.

This method performs path composition only; consumers that persist untrusted data must apply their own containment and symbolic-link policy.

Parameters

string $path

Return Value

string

resolveWritablePath

string resolveWritablePath(string $path = '')

Preserves an absolute path or resolves a relative path below private writable storage.

Parameters

string $path

Return Value

string

resolveLogPath

string resolveLogPath(string $path = '')

Preserves an absolute path or resolves a relative path below writable log storage.

Parameters

string $path

Return Value

string

resolveSessionPath

string resolveSessionPath(string $path = 'sessions')

Preserves an absolute path or composes a relative path below writable session storage.

File-backed session construction subsequently enforces traversal, symlink, ownership, permission, and public-webroot boundaries; this general context helper performs path composition only.

Parameters

string $path

Return Value

string

resolveUploadPath

string resolveUploadPath(string $path = '')

Resolves an upload path using the public upload storage convention.

Parameters

string $path

Return Value

string

uploadPath

string uploadPath(string $path = '')

Preserves an absolute path or resolves a relative path below the public uploads directory.

Parameters

string $path

Return Value

string

resolveCachePath

string resolveCachePath(string $path = '')

Preserves an absolute path or resolves a relative path below application cache storage.

Parameters

string $path

Return Value

string

uploadRelativePath

string uploadRelativePath(string $path = '')

Returns a portable forward-slash path relative to the public root for an upload location.

Parameters

string $path

Return Value

string

isProduction

bool isProduction()

Reports whether production runtime behavior is active.

Return Value

bool

isDevelopment

bool isDevelopment()

Reports whether development runtime behavior is active.

Return Value

bool

isTesting

bool isTesting()

Reports whether testing runtime behavior is active.

Return Value

bool