Properties

$view

$view : \Charcoal\View\ViewConfig

The application's view/rendering configset.

Type

\Charcoal\View\ViewConfig

$timezone

$timezone : string|null

The application's timezone.

Type

string|null

$projectName

$projectName : string|null

The application's name.

For internal usage.

Type

string|null

$basePath

$basePath : string|null

The base path for the Charcoal installation.

Type

string|null

$baseUrl

$baseUrl : \Psr\Http\Message\UriInterface|null

The base URL (public) for the Charcoal installation.

Type

\Psr\Http\Message\UriInterface|null

$publicPath

$publicPath : string|null

The path to the public / web directory.

Type

string|null

$storagePath

$storagePath : string|null

The path to the storage directory.

Type

string|null

$devMode

$devMode : boolean

Whether the debug mode is enabled (TRUE) or not (FALSE).

Type

boolean

$routes

$routes : array

The application's routes.

Type

array

$routables

$routables : array

The application's dynamic routes.

Type

array

$handlers

$handlers : array

The application's handlers.

Type

array

$modules

$modules : array

The application's modules.

Type

array

$databases

$databases : array

The application's database configsets.

Type

array

$defaultDatabase

$defaultDatabase : string

The application's default database configset.

Type

string

Methods

defaults()

defaults() : array

Default app-config values.

Returns

array

setBasePath()

setBasePath(string  $path) : \Charcoal\App\AppConfig

Set the application's absolute root path.

Resolves symlinks with realpath() and ensure trailing slash.

Parameters

string $path

The absolute path to the application's root directory.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\App\AppConfig

Chainable

basePath()

basePath() : string

Retrieve the application's absolute root path.

Returns

string —

The absolute path to the application's root directory.

setPublicPath()

setPublicPath(string  $path) : \Charcoal\App\AppConfig

Set the application's absolute path to the public web directory.

Parameters

string $path

The path to the application's public directory.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\App\AppConfig

Chainable

publicPath()

publicPath() : string

Retrieve the application's absolute path to the public web directory.

Returns

string —

The absolute path to the application's public directory.

setStoragePath()

setStoragePath(string|null  $path) : $this

Set the application's absolute path to the storage directory.

Parameters

string|null $path

The path to the application's storage directory.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

$this

storagePath()

storagePath() : string

Get the path to the storage directory.

Note that the storage space is outside of the public access.

Returns

string

setBaseUrl()

setBaseUrl(\Psr\Http\Message\UriInterface|string  $uri) : \Charcoal\App\AppConfig

Set the application's fully qualified base URL to the public web directory.

Parameters

\Psr\Http\Message\UriInterface|string $uri

The base URI to the application's web directory.

Returns

\Charcoal\App\AppConfig

Chainable

baseUrl()

baseUrl() : \Psr\Http\Message\UriInterface|null

Retrieve the application's fully qualified base URL to the public web directory.

Returns

\Psr\Http\Message\UriInterface|null —

The base URI to the application's web directory.

setTimezone()

setTimezone(string  $timezone) : \Charcoal\App\AppConfig

Set the application's default timezone.

Parameters

string $timezone

The timezone string.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\App\AppConfig

Chainable

timezone()

timezone() : string

Retrieve the application's default timezone.

Will be used by the PHP date and date-time functions.

Returns

string

setProjectName()

setProjectName(string|null  $projectName) : \Charcoal\App\AppConfig

Sets the project name.

Parameters

string|null $projectName

The project name.

Throws

\InvalidArgumentException

If the project argument is not a string (or null).

Returns

\Charcoal\App\AppConfig

Chainable

projectName()

projectName() : string|null

Returns

string|null

setDevMode()

setDevMode(boolean  $devMode) : \Charcoal\App\AppConfig

Parameters

boolean $devMode

The "dev mode" flag.

Returns

\Charcoal\App\AppConfig

Chainable

devMode()

devMode() : boolean

Returns

boolean

setView()

setView(array  $view) : \Charcoal\App\AppConfig

Parameters

array $view

The view configuration structure to set.

Returns

\Charcoal\App\AppConfig

Chainable

setRoutes()

setRoutes(array  $routes) : \Charcoal\App\AppConfig

Parse the application's route configuration.

Parameters

array $routes

The route configuration structure to set.

Returns

\Charcoal\App\AppConfig

Chainable

routes()

routes() : array

Returns

array

setRoutables()

setRoutables(array  $routables) : \Charcoal\App\AppConfig

Parameters

array $routables

The routable configuration structure to set.

Returns

\Charcoal\App\AppConfig

Chainable

routables()

routables() : array

Returns

array

setHandlers()

setHandlers(array  $handlers) : \Charcoal\App\AppConfig

Define custom response and error handlers.

Slim provides five standard handlers:

  • "foundHandler"
  • "notFoundHandler"
  • "notAllowedHandler"
  • "errorHandler"
  • "phpErrorHandler"

Parameters

array $handlers

The handlers configuration structure to set.

Returns

\Charcoal\App\AppConfig

Chainable

handlers()

handlers() : array

Returns

array

setModules()

setModules(array  $modules) : \Charcoal\App\AppConfig

Set the configuration modules.

The modules are defined in a key=>\Charcoal\App\Module\ModuleConfig structure.

Parameters

array $modules

The module configuration structure to set.

Returns

\Charcoal\App\AppConfig

Chainable

modules()

modules() : array

Returns

array

setCache()

setCache(array|\Charcoal\App\Config\CacheConfig  $cache) : \Charcoal\App\AppConfig

Parameters

array|\Charcoal\App\Config\CacheConfig $cache

The application global cache config.

Throws

\InvalidArgumentException

If the argument is not an array or a config.

Returns

\Charcoal\App\AppConfig

Chainable

setLogger()

setLogger(array|\Charcoal\App\Config\LoggerConfig  $logger) : \Charcoal\App\AppConfig

Parameters

array|\Charcoal\App\Config\LoggerConfig $logger

The global logger config.

Throws

\InvalidArgumentException

If the argument is not an array or a config.

Returns

\Charcoal\App\AppConfig

Chainable

setDatabases()

setDatabases(array  $databases) : \Charcoal\App\Config

Parameters

array $databases

The avaiable databases config.

Returns

\Charcoal\App\Config —

Chainable

databases()

databases() : array

Throws

\Exception

If trying to access this method and no databases were set.

Returns

array

databaseConfig()

databaseConfig(string  $ident) : array

Parameters

string $ident

The ident of the database to return the configuration of.

Throws

\InvalidArgumentException

If the ident argument is not a string.

\Exception

If trying to access an invalid database.

Returns

array

setDefaultDatabase()

setDefaultDatabase(string  $defaultDatabase) : \Charcoal\App\AppConfig

Parameters

string $defaultDatabase

The default database ident.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\App\AppConfig

Chainable

addDatabase()

addDatabase(string  $ident, array  $config) : \Charcoal\App\AppConfig

Parameters

string $ident

The database ident.

array $config

The database options.

Throws

\InvalidArgumentException

If the arguments are invalid.

Returns

\Charcoal\App\AppConfig

Chainable

defaultDatabase()

defaultDatabase() : mixed

Throws

\Exception

If trying to access this method before a setter.

Returns

mixed

setFilesystem()

setFilesystem(array|\Charcoal\App\Config\FilesystemConfig  $filesystem) : \Charcoal\App\AppConfig

Parameters

array|\Charcoal\App\Config\FilesystemConfig $filesystem

The application global cache config.

Throws

\InvalidArgumentException

If the argument is not an array or a config.

Returns

\Charcoal\App\AppConfig

Chainable