PHP Classes

Configuration file setup: Read configuration values from JSON files

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 222 All time: 8,224 This week: 135Up
Version License PHP version Categories
configuration 1.0.0Free For Educatio...5PHP 5, Configuration


This package can read configuration values from JSON files.

It can read a JSON file with setting values and returns an array with the values.

The class also sets the application_path setting to the parent of the current directory.

Picture of raghavender
  Performance   Level  
Name: raghavender <contact>
Classes: 2 packages by
Country: India India
Age: 36
All time rank: 3664254 in India India
Week rank: 683 Up51 in India India Up


include_once 'Configuration.php';
$con = new Configuration();
$config_vars = $con->constants();

defined('APPLICATION_PATH') || define('APPLICATION_PATH', $config_vars['application_path']);

//Social Media Settings
defined('FB_ID') || define('FB_ID', $config_vars['social_media_settings']['fb_api_key']);

defined('GPLUS_CLIENT_KEY') || define('GPLUS_CLIENT_KEY', $config_vars['social_media_settings']['gplus_client_key']);
defined('GPLUS_CLIENT_SECRET') || define('GPLUS_CLIENT_SECRET', $config_vars['social_media_settings']['gplus_client_secret']);


  Files folder image Files  
File Role Description
Accessible without login Plain text file config.php Example configure php variables which are used in application
Plain text file Configuration.php Class Class for creating global variables, DB connection, sanitization of data
Accessible without login Plain text file configurations.json Data provide configuration variables from json file
Plain text file dbConnection.php Class Connect to Mysql

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,224
This week:135Up