GitHub Repository

apiato

Definition

Configs are files that container configurations. For more details about them check this doc.

In each Apiato container, there are two types of config files:

Principles

Rules

Folder Structure

- app
    - Containers
        - {container-name}
            - Configs
                - {container-name}-container.php
                - package-config-file1.php
                - ...
    - Ship
        - Configs
            - apiato.php
            - ...
- config
    - app.php
    - ...

Code Samples

Example simple Config file

<?php
// app/Containers/{ContainerName}/Configs/{container-name}-container.php
return [

    /*
    |--------------------------------------------------------------------------
    | Default Namespace
    |--------------------------------------------------------------------------
    */
    'namespace'       => 'App',

    // some other config params here...

You can access the respective configuration key like this:

$value = Config::get('{container-name}-container.namespace');     // returns 'App'
$value = config('{container-name}-container.namespace');          // same, but using a function

$defaultValue = Config::get('{container-name}-container.unknown.key', 'defaultvalue');   // returns 'defaultvalue' as this key is not set!