PHP Classes

Pure PHP Config: Access configuration values stored in PHP scripts

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 63 All time: 10,362 This week: 108Up
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: 29
All time rank: 201929 in Bangladesh Bangladesh
Week rank: 358 Up12 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  
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  /  src  
File Role Description
  Plain text file DotArrayAccessor.php Class Class source
  Plain text file PurePhpConfig.php Class Class source

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

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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:63
This week:0
All time:10,362
This week:108Up