Skip to content

Instantly share code, notes, and snippets.

@178inaba
Last active June 2, 2016 03:09
Show Gist options
  • Save 178inaba/5be75e67d2b0abe6d113a78d71a53dcb to your computer and use it in GitHub Desktop.
Save 178inaba/5be75e67d2b0abe6d113a78d71a53dcb to your computer and use it in GitHub Desktop.
get toml value for zf1
<?php
use Yosymfony\Toml\Toml;
if (! function_exists('toml')) {
function toml($key = null)
{
$toml = [];
$paths = glob('../application/configs/toml/*.toml');
foreach ($paths as $path) {
$filename = basename($path, '.toml');
$toml[$filename] = Toml::Parse($path);
}
if ($key === null) {
return $toml;
}
$keys = explode('.', $key);
foreach ($keys as $value) {
$toml = $toml[$value];
}
return $toml;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment