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:
Date: 1 year ago
Size: 510 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;

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

For more information send a message to info at phpclasses dot org.