PHP code example of simplon / config

1. Go to this page and download the library: Download simplon/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/ */

    

simplon / config example snippets


$app = [
  'url'      => [
    'service'  => '[URL_SERVICE]',
    'frontend' => '[URL_FRONTEND]',
  ],

  'database' => [
    'mysql' => [
      'localhost' => [
        'server'   => 'localhost',
        'database' => 'some_db',
        'username' => 'rootuser',
        'password' => 'rootuser'
      ]
    ],
  ],
  'email'    => [
    'host' => 'localhost',
    'port' => 25,
  ],
];

[
  'service'  => '[URL_SERVICE]',
  'frontend' => '[URL_FRONTEND]',
];

use Simplon\Config\Config;

$configPath = __DIR__ . '/../../config/common.config.php';

$urlService = Config::getInstance()
->setConfigPath($configPath)
->getConfigByKeys(['url', 'service']);

echo $urlService; // prints "[URL_SERVICE]"