1. Go to this page and download the library: Download devium/toml library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
devium / toml example snippets
$toml = <<<TOML
# This is a TOML document
title = "TOML Example"
[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00
TOML;
dump(\Devium\Toml\Toml::decode($toml, asArray: true));
dump(\Devium\Toml\Toml::decode($toml, asArray: false));
// or use global helper
dump(toml_decode($toml, asArray: false));
dump(toml_decode($toml, asArray: true));
$data = [
"title" => "TOML Example",
"owner" => [
"name" => "Tom Preston-Werner",
"dob" => "1979-05-27T15:32:00.000Z",
],
];
dump(\Devium\Toml\Toml::encode($data));
// or use global helper
dump(toml_encode($data));