PHP Classes

Simple Configurations class: Set and get configuration values in static vars

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 139 All time: 9,232 This week: 571Up
Version License PHP version Categories
simple-configuration 1.0GNU General Publi...5PHP 5, Configuration
Description 

Author

This class can set and get configuration values in static variables.

It can set individual values with given names or of a set of values passing an associative array of values.

The stored individual configuration values can be retrieved from anywhere in the application.

Picture of Yerfry Ramirez
  Performance   Level  
Innovation award
Innovation award
Nominee: 1x

 

Example

<?php

require 'config.class.php';

Configuration::set('MySQL', [
   
'Hostname' => '127.0.0.1',
   
'Username' => 'root',
   
'Password' => 'root',
   
'Database' => 'database'
]);

Configuration::set([
   
'Example1' => 'Value1',
   
'Example2' => 'Value2'
]);

Configuration::set('Test', 'Value');

print_r(Configuration::get('MySQL'));

echo
'<br />';

echo
Configuration::get('Example1');

echo
'<br />';

echo
Configuration::get('Example2');

echo
'<br />';

echo
Configuration::get('Test');
?>


  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file Example.config.php Example A simple explanation of usage
Plain text file config.class.php Class The class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:139
This week:0
All time:9,232
This week:571Up