Skip to content
Vicary Archangel edited this page Jun 17, 2015 · 3 revisions

Configuration Class

The Configuration class locates in framework namespace, the default collection name is Configurations.

Because the framework relies on it regardless of a database connection, this class will automatically fall back to file system when no database connection is available.

Natively it supports JSON files, and YAML is also loaded if the respective extension(s) is available.

The logic is simple.

  1. If a database connection is available, query and decode the contents.
  2. If FALLBACK_DIRECTORY . "/$key.json" is readable and json_decode exists, decodes file contents and merge + with the configuration object.
  3. If FALLBACK_DIRECTORY . "/$key.yaml" is readable and yaml_parse_file exists, decodes file contents and merge + with the configuration object.

Configuration Entries

  • system.domains

    • default

      (Optional) The default hostname to use when making and detecting redirections, defaults to the machine network name gethostname().

    • secure

      (Optional) Hostname to use when redirecting to secure paths, if not defined the redirection will be done in normal mode.

    • local

      (Optional) Hostname to local machine, used when making local redirections.

    • service

      (Optional) Hostname specifically when making service redirections.

  • database.connection

    • driver string

      PDO DSN prefix, currently only "mysql" is supported.

    • host string

      Host to connect to, defaults null. Which works according to PHP default, usually defined in php.ini.

    • port int

      Connection port

    • schema {string}

      (Optional) Database name.

    • user string

      (Optional) Username when making connection.

    • password string

      (Optional) Password when making connection.

    • options array

      (Optional) PDO driver options, refer to the docs according to the chosen driver. String keys in this array are treated as constant names under the PDO class, unable to resolve that name skips it.

Clone this wiki locally