PHP code example of sinergi / config

1. Go to this page and download the library: Download sinergi/config library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sinergi / config example snippets


use Sinergi\Config\Collection;

$config = Collection::factory([
    'path' => __DIR__ . "/configs"
]);

use Sinergi\Config\Collection;

$config = Collection::factory([
    'path' => __DIR__ . "/configs",
    'environment' => 'prod'
]);

use Sinergi\Config\Collection;

$config = Collection::factory([
    'path' => __DIR__ . "/configs",
    'dotenv' => __DIR__,
    'environment' => 'prod'
]);

$config->get('app.timezone');

$config->get('app.timezone');

$config->get('app.timezone', "America/New_York");

$config->get('database.connections.default.host');

$config->set('app.timezone', "Europe/Berlin");

$config->set('database', [
    'host' => "localhost",
    'dbname' => "my_database",
    'user' => "my_user",
    'password' => "my_password"
]);

return [
    'timezone' => "America/New_York"
];

return [
    'timezone' => env('TIMEZONE', "America/New_York")
];