Download the PHP package purrphp/yaml without Composer

On this page you can find all versions of the php package purrphp/yaml. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yaml

PurrPHP/Yaml

An object oriented YAML 1.2 parser for PHP 8.3+.

Every part of a YAML source is a class: the stream, its documents and each node (scalar, sequence, mapping, alias) keeps its style, tag, anchor and source line. Anchors and references (&anchor, *alias, <<:) are first class citizens — an alias node links to the very node it points at instead of a copy of its value.

Installation

Entry points

YamlStream works with any number of documents in a source. YamlStreamSingle expects exactly one document and throws InvalidDocumentsCountException otherwise.

Parsing to PHP values

With a single-document source, YamlStreamSingle is a shorter alternative:

Working with the model

fromString() returns a DocumentList — the parsed model instead of plain arrays:

Class Represents
DocumentList all documents of one source
Document one document plus its anchors
ScalarNode a scalar, with its ScalarStyle
SequenceNode a block or flow sequence
MappingNode / MappingEntry a block or flow mapping and its pairs
AliasNode a *reference linked to its anchored node
Tag !!str, !custom, …

Dumping back to YAML

The dumper turns the document model back into YAML text, preserving styles, tags and anchors:

References

Merge keys behave as the YAML spec describes: the merging mapping wins over the merged one, and when several sources are merged (<<: [*a, *b]) the first one wins.

The links themselves stay visible in the model:

Visiting nodes

Nodes accept any NodeVisitor, which makes it easy to build your own transformation instead of going through arrays:

Scalar typing is driven by a Schema. CoreSchema implements the YAML 1.2 core schema; pass your own to the YamlStream constructor (or straight to Document::getValue()) to change how scalars become PHP values:

Supported syntax

YAML 1.2 only. Sources with a %YAML directive must declare version 1.2; other versions (such as 1.1) are rejected. Scalar typing follows the YAML 1.2 core schema (true/false, not yes/no).

Block and flow collections, plain, single and double quoted scalars (with escape sequences), literal | and folded > block scalars with indentation and chomping indicators, multi line plain scalars, comments, multiple documents (---, ...), directives, anchors, aliases, merge keys and tags (!!str, !!int, !!float, !!bool, !!null, !!binary, plus custom tags kept on the node).

Not supported: explicit keys (? key), verbose tag resolution against %TAG directives, and recursive anchors.

Errors

Every failure implements Purr\Yaml\Exception\YamlException: ParseException (with the offending line), ReferenceException (undefined anchor or unmergeable value), ValueException (a collection used as a mapping key), InvalidDocumentsCountException (when YamlStreamSingle sees other than one document), and IoException.

Development

With Docker / Make

License

MIT — see LICENSE.


All versions of yaml with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
purrphp/pure-collection Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package purrphp/yaml contains the following files

Loading the files please wait ...