dev-master
9999999-devAdd some features to symfony/yaml
MIT
The Requires
1.0.2
1.0.2.0Add some features to symfony/yaml
MIT
The Requires
Add some features to symfony/yaml
Add features to symfony/yaml., (*2)
As steevanb\PhpYaml\Parser extends Symfony\Component\Yaml\Parser, you have all Symfony YAML parser features., (*3)
Changelog, (*4)
Use composer require :, (*5)
composer require steevanb/php-yaml ^1.0
Or add it manually to composer.json :, (*6)
{ "require": { "steevanb/php-yaml": "^1.0" } }
Instead of calling Symfony\Component\Yaml\Yaml::parse($content), you have to do this :, (*7)
use steevanb\PhpYaml\Parser; $parser = new Parser(); $parser->parse(file_get_contents('foo.yml'));
You can call registered functions in yaml value :, (*8)
foo: call_file_get_contents: <file('baz.txt')> call_new_DateTime: <date()> call_new_DateTime2: <date('2017-12-31')>
By default, no function is registered into Parser. You need to manually register every function you need., (*9)
You can register file($fileName) function. $path is $fileName path prefix :, (*10)
steevanb\PhpYaml\Parser::registerFileFunction($path = null);
You can register <date($format = null)> function :, (*11)
steevanb\PhpYaml\Parser::registerDateFunction();
You can register your own function :, (*12)
steevanb\PhpYaml\Parser::registerFunction('foo', function($bar, $baz) { return $bar + $baz; });
And call it in yaml :, (*13)
foo: bar: <foo(41, 1)>
Add some features to symfony/yaml
MIT
Add some features to symfony/yaml
MIT