ini2yaml in PHP

If you still use INI file for some of your PHP-projects configuration, I guess it is time for you to migrade to YAML which is more flexible and has way more expressiveness. Here is a little tool to help you in migration process

<?php
    require "Spyc.php";
    if ($argc != 3)
        die("I need 2 parameters: in_file.ini, out_file.yml\n");

    if (!is_readable($argv[1]))
        die("can't read from ".$argv[1]."\n");

    $ini = parse_ini_file($argv[1], true);
    file_put_contents($argv[2], Spyc::YAMLDump($ini));
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • DZone
  • FriendFeed
  • Reddit
  • Tumblr
  • Twitter

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

blog comments powered by Disqus