symplely/yaml

A Async simple YAML loader/dumper class for PHP

Maintainers

👁 techno-express

Package info

github.com/symplely/yaml

Homepage

pkg:composer/symplely/yaml

Statistics

Installs: 49

Dependents: 1

Suggesters: 0

Stars: 2

Open Issues: 1

1.0.1 2019-09-19 21:31 UTC

Requires

  • php: ^7.0

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT fc5f1e10524cb41e168af53c0b676f4761891e59

  • mustangostang <vlad.andersen.woop@gmail.com>
  • Lawrence Stubbs <lstubbs.woop@techno.express>

yamlymlasync

This package is auto-updated.

Last update: 2026-06-29 00:49:55 UTC


README

👁 Build Status
👁 Build status
👁 codecov
👁 Codacy Badge
👁 Maintainability

An pure PHP implementation base YAML loader/dumper.

  • Given a YAML document, will return an array that you can use however you see fit.

  • Given an array, will return a string which contains a YAML document built from your data.

YAML is an amazingly human friendly and strikingly versatile data serialization language which can be used for log files, config files, custom protocols, the works. For more information, see http://www.yaml.org.

Supporting YAML 1.1 specification.

Installation

composer require symplely/yaml

Usage

Using Yaml is trivial:

The parse() or loader() method parses a YAML string and converts it to a PHP array:

require 'vendor/autoload.php';

use Async\Yaml;

 // Reading YAML Contents
$Data = Yaml::loader('config.yaml');
// Or
$Data = Yaml::parse("foo: bar");
// Or
$Data = yaml_load("foo: bar");
// $Data = ['foo' => 'bar']

or (if you prefer functional syntax)

require 'vendor/autoload.php';

$Data = yaml_load_file('config.yaml');

The dumper() method dumps any PHP array to its YAML representation:

require 'vendor/autoload.php';

use Async\Yaml;

$array = [
 'foo' => 'bar',
 'bar' => ['foo' => 'bar','bar' => 'baz'],
];

$yaml = Yaml::dumper($array);
// Or
$yaml = yaml_dump($array);

// Writing YAML Files
file_put_contents('/path/to/file.yaml', $yaml);