PHP Classes

Pure PHP Config: Access configuration values stored in PHP scripts

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 enough user ratingsTotal: 64 All time: 10,420 This week: 53Up
Version License PHP version Categories
pure-php-config 1.0.0MIT/X Consortium ...5PHP 5, Configuration
Description 

Author

This package can be used to access configuration values stored in PHP scripts.

It can load configuration values from a given PHP script that returns an associative array.

The package main class provides functions to get, set, delete and chek if it exists given configuration value by passing a string using the dot notation format to identify the path of the value in the array that is being accessed.

Picture of Miraz Mac
  Performance   Level  
Name: Miraz Mac <contact>
Classes: 13 packages by
Country: Bangladesh Bangladesh
Age: 30
All time rank: 201429 in Bangladesh Bangladesh
Week rank: 214 Up5 in Bangladesh Bangladesh Up
Innovation award
Innovation award
Nominee: 5x

Example

<?php

use MirazMac\PurePhpConfig\PurePhpConfig;

require_once
'../vendor/autoload.php';

$config = new PurePhpConfig(__DIR__ . '/config');

// Access a value
var_dump($config->get('app.url'));


// Delete a key
var_dump($config->delete('app.twig.auto'));

echo
"<br>";

// Access a nested value using dot notation
var_dump($config->get('app.twig.cache'));

echo
"<br>";

// Check if a key exists
var_dump($config->exists('app.twig'));

echo
"<br>";

// Provided with only namespace, so will return all data as array
var_dump($config->get('app'));
echo
"<br>";

// Set a value
var_dump($config->set('app.url', 'https://google.com'));

echo
"<br>";
// Set a nested value using dot notation
var_dump($config->set('app.twig.cache', false));

echo
"<br>";
// Replace an entire namespace data
var_dump($config->set('app', ['name' => 'NewApp']));


  Files folder image Files (5)  
File Role Description
Files folder imagesrc (2 files)
Files folder imageusage (1 file, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data

  Files folder image Files (5)  /  src  
File Role Description
  Plain text file DotArrayAccessor.php Class Class source
  Plain text file PurePhpConfig.php Class Class source

  Files folder image Files (5)  /  usage  
File Role Description
Files folder imageconfig (1 file)
  Accessible without login Plain text file usage.php Example Example script

  Files folder image Files (5)  /  usage  /  config  
File Role Description
  Accessible without login Plain text file app.php Aux. Auxiliary script

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  
 100%
Total:64
This week:0
All time:10,420
This week:53Up