2017 © Pedro Peláez
 

lib php-yaml

Add some features to symfony/yaml

image

steevanb/php-yaml

Add some features to symfony/yaml

  • Tuesday, February 13, 2018
  • by kujaff
  • Repository
  • 1 Watchers
  • 0 Stars
  • 208 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 17 % Grown

The README.md

version symfony Lines Total Downloads SensionLabsInsight Scrutinizer, (*1)

php-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)

Installation

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"
    }
}

How to use

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'));

Function support

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)>

The Versions

13/02 2018

dev-master

9999999-dev

Add some features to symfony/yaml

  Sources   Download

MIT

The Requires

 

13/02 2018

1.0.2

1.0.2.0

Add some features to symfony/yaml

  Sources   Download

MIT

The Requires

 

11/04 2017

1.0.1

1.0.1.0

Add some features to symfony/yaml

  Sources   Download

MIT

The Requires

 

18/03 2017

1.0.0

1.0.0.0

Add some features to symfony/yaml

  Sources   Download

MIT

The Requires