2017 © Pedro Peláez
 

library config

An ini config loader class for easy configuration loading and access.

image

truecastdesign/config

An ini config loader class for easy configuration loading and access.

  • Wednesday, December 6, 2017
  • by truecastdesign
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Config - .ini config file manager for PHP

This library provides the ability to create, read/load into memory, and write configuration files in the .ini format., (*1)

Install

To install with composer:, (*2)

composer require truecastdesign/config

Requires PHP 5.5 or newer., (*3)

Usage

Here's a basic usage example:, (*4)

Create config file in the format:, (*5)

; MySQL database config

config_title = 'mysql'
type = 'mysql'
hostname = 'localhost'
username = 'root'
password  = 'password'
database  = 'dbname'
port = 3306
persistent = true
emulate_prepares = false
compress = true
charset = 'utf8'
buffer = true
<?

# composer autoloader
require '/path/to/vendor/autoload.php';

# load in needed config files into Config object
$TAConfig = new \Truecast\Config('/path/to/config/mysql.ini'); # standard path: __DIR__.'/../app/config/mysql.ini'

# can load multiple config files at once with a comma between. Example: '/path/to/config/mysql.ini, /path/to/config/site.ini'

Accessing Config Values

The "config_title" in the config file is the keyword you use to access that config file. To access one of the other values you would use a sub object key., (*6)

echo $TAConfig->mysql->username; # this would output the string "root" using the above config file.

To use sections within a config file you use square brackets around the section title., (*7)

Example:, (*8)

config_title="items"

[secion_title]
name="The Name"
version="1.0"
date="2017-02-12"
show=true
sort=2

[secion_title_two]
name="The Name"
version="1.0"
date="2017-02-12"
show=true
sort=2

These section values can be accessed by adding an extra object level using the section title when getting the value., (*9)

Example:, (*10)

echo $TAConfig->items->secion_title_two->version;

The Versions

06/12 2017

dev-master

9999999-dev

An ini config loader class for easy configuration loading and access.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Daniel Baldwin

framework php config slim loader

06/12 2017

v1.1.2

1.1.2.0

An ini config loader class for easy configuration loading and access.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Daniel Baldwin

framework php config slim loader

05/12 2017

v1.1.1

1.1.1.0

An ini config loader class for easy configuration loading and access.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Daniel Baldwin

framework php config slim loader