PHP code example of steevanb / php-yaml

1. Go to this page and download the library: Download steevanb/php-yaml 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/ */

    

steevanb / php-yaml example snippets


use steevanb\PhpYaml\Parser;
$parser = new Parser();
$parser->parse(file_get_contents('foo.yml'));

steevanb\PhpYaml\Parser::registerFileFunction($path = null);

steevanb\PhpYaml\Parser::registerDateFunction();

steevanb\PhpYaml\Parser::registerFunction('foo', function($bar, $baz) {
    return $bar + $baz;
});
bash
composer 
`yaml
foo:
    call_file_get_contents: <file('baz.txt')>
    call_new_DateTime: <date()>
    call_new_DateTime2: <date('2017-12-31')>