pixel418 / iniliq
An ini parser for inherited values through multiple configuration files
Installs: 21 746
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 2
Open Issues: 1
Requires
- php: >=5.3.0
- pixel418/ubiq: 0.4.*
README
An ini parser for inherited values through multiple configuration files
- Let's code
1.1 Json Values
1.2 Deep selectors
1.3 File inheritance
1.4 Appending
1.5 Reducing - How to Install
- How to Contribute
- Author & Community
Let's code
Json values
; json-values.ini [Readme] example = { json: yeah, is-it: [ good, great, awesome ] }
$ini = ( new \Pixel418\Iniliq\IniParser )->parse( 'json-values.ini' ); // [ 'Readme' => [ 'example' => [ 'json' => 'yeah', 'is-it' => [ 'good', 'great', 'awesome' ] ] ] ]
Deep selectors
; deep-selectors.ini [Readme] example.selectors.deep = nice
$ini = ( new \Pixel418\Iniliq\IniParser )->parse( 'deep-selectors.ini' ); // [ 'Readme' => [ 'example' => [ 'selectors' => [ 'deep' => 'nice' ] ] ] get_class( $ini ); // Pixel418\Iniliq\ArrayObject $ini[ 'Readme.example.selectors.deep' ] // nice $ini[ 'Readme.example.selectors.deep' ] = 'amusing' // [ 'Readme' => [ 'example' => [ 'selectors' => [ 'deep' => 'amusing' ] ] ]
File inheritance
; base.ini [Readme] example[name] = John Doe example[id] = 3
; file-inheritance.ini [Readme] example.name = file-inheritance
$ini = ( new \Pixel418\Iniliq\IniParser )->parse( [ 'base.ini', 'file-inheritance.ini' ] ); // [ 'Readme' => [ 'example' => [ 'name' => 'file-inheritance', 'id' => '3' ] ] ]
Appending
; list.ini [Readme] musketeers.name[ ] = Athos musketeers.name[ ] = Porthos musketeers.name[ ] = "D'Artagnan"
; adding-values.ini [Readme] musketeers.name += [ Aramis ]
$ini = ( new \Pixel418\Iniliq\IniParser )->parse( [ 'list.ini', 'adding-values.ini' ] ); // [ 'Readme' => [ 'musketeers' => [ 'Athos', 'Porthos', 'D\'Artagnan', 'Aramis' ] ] ]
Reducing
; list.ini [Readme] musketeers.name[ ] = Athos musketeers.name[ ] = Porthos musketeers.name[ ] = "D'Artagnan"
; removing-values.ini [Readme] musketeers.name -= "[ D'Artagnan ]"
$ini = ( new \Pixel418\Iniliq\IniParser )->parse( [ 'list.ini', 'removing-values.ini' ] ); // [ 'Readme' => [ 'musketeers' => [ 'Athos', 'Porthos' ] ] ]
How to Install
If you don't have composer, you have to install it.
Add or complete the composer.json file at the root of your project, like this :
{ "require": { "pixel418/iniliq": "0.3.2" } }
Iniliq can now be downloaded via composer.
Lastly, to use it in your PHP, you can load the composer autoloader :
require_once( './vendor/autoload.php' );
How to Contribute
- Fork the Iniliq repository
- Create a new branch for each feature or improvement
- Send a pull request from each feature branch to the develop branch
If you don't know much about pull request, you can read the Github article.
All pull requests must follow the PSR1 standard and be accompanied by passing phpunit tests.
Author & Community
Iniliq is under the MIT License.
It is created and maintained by Thomas ZILLIOX.