Convert YAML file to PHP File -
i have bunch of yaml configuration files want convert straight php files application not have process yaml files every time.
i know there lot of libraries out there let convert yaml php array, there libraries let convert yaml file php file?
the thing makes tricky converting yaml file php produce multidimensional array.
thanks.
update:
i realized following code think need. notice second paramter in print_r. pretty cool...
$test = print_r($yaml, true); file_put_contents('test.php', $test);
there simple builtin export php variable/array, allows write small script task:
$array = yaml_import(...); $array = var_export($array, 1); file_put_contens($fn, "<?php \$array = $array; ?>");
Comments
Post a Comment