TOML for PHP
Parsing TOML with PHP. Supports TOML Specs 0.2.0., (*1)
, (*2)
Installation
Use Composer and add this to your composer.json:, (*3)
"require": {
"zidizei/toml-php", "~0.3.0"
}
If you want you can just download/clone the source code from GitHub as well. Just include the src/Toml/Toml.php file in your application and you should be good to go., (*4)
Usage
The following will parse a TOML formatted String:, (*5)
$array = \Toml\parse('title = "TOML Example"');
To parse a TOML file, you can just use the same helper function:, (*6)
$array = \Toml\parse('tests/example.toml');
Tests
Tests are done using PHPUnit and Composer's autoloader (vendor/autoload.php is bootstrapped by phpunit to include the TOML parser class to be tested):, (*7)
composer install
phpunit