PHP Classes

File: docs/extensions/Config.md

Recommend this page to a friend!
  Classes of Slawomir Kaleta   Dframe Framework   docs/extensions/Config.md   Download  
File: docs/extensions/Config.md
Role: Example script
Content type: text/markdown
Description: Example script
Class: Dframe Framework
Modular MVC based PHP Web framework
Author: By
Last change: Update of docs/extensions/Config.md
Date: 3 years ago
Size: 517 bytes
 

Contents

Class file image Download

Dframe\Config

You can fast set and load configs

Create file in app\config\myConfigFile.php

<?php
return [
    'key1' => 'value', 
    'key2' => ['value'],
    'key3' => [
        'key1' => 'value'
    ]
];

Usage in controller

<?php
use Dframe\Config\Config;

include_once 'vendor/autoload.php';

$config = Config::load('myConfigFile');

echo $config->get('key1'); // display 'value'
echo $config->get('keyValid', 'yes'); // display 'yes' ||  if key is not exist then you can replace value