xaddax/factories

v1.0 2019-03-20 22:03 UTC

This package is auto-updated.

Last update: 2024-10-10 22:10:50 UTC


README

Install

composer require xaddax/factories

GatherConfigValues

This will look for values from both the Laminus config files and a .env file. Usage

    $values = (new GatherConfigValues)($container, 'group');

if in your .env file you have

GROUP_MY_VALUE=42
GROUP_IS_AWESOME=true
NOTGROUP_IS_AWESOME=false

and in your *.global.php you have

return [
    'group' => [
        'isFun' = true,
        'options' => [
            'color' => 'purple',
            'size'  => 'large',
        ],
    ],
];

then $values would look like

[
    'myValue'   => 42,
    'isAwesome' => true,
    'isFun'     => true,
    'options'   => [
        'color' => 'purple',
        'size'  => 'large',
    ],
]

MongoDB

The configuration can happen through ENV variables, autoload configuration or a combination of the two, with ENV taking priority.

config/autoload/mongodb.global.php

return [
    'mongodb' => [
        'uri' => 'mongodb://127.0.0.1/',
        'uriOptions' => [],
        'serverOptions' => [], // todo
    ],
];

uriOptions can be found in the PHP documentation

environment variables

MONGODB_URI=mongodb://127.0.0.1/