The Yaml component loads and dumps YAML files.

Last update: May 16, 2022
Comments
  • 1. Nested merge keys

    I think there is a bug with nested keys in some case. For starters I updated the merge key test to show the behavior I expect and the error that is instead produce

    Reviewed by mathroc at 2015-07-08 15:02
  • 2. Proper inheritance when merging references and inline

    Items now get referenced sub-properties merged:

    refDef: &reference
        subitem:
            refUnique: true
            shared: "Reference value"
    
    item:
        <<: *reference
        subitem:
            itemUnique: true
            shared: "Item value"
    

    OLD RESULT:

    item:
        subitem:
            itemUnique: true
            shared: "Item value"
    

    NEW RESULT

    item:
        subitem:
            itemUnique: true
            shared: "Item value"
            refUnique: true
    

    Inheritance is reversed when reference is pulled-in after all the elements:

    item:
        subitem:
            itemUnique: true
            shared: "Item value"
        <<: *reference
    

    NEW RESULT

    item:
        subitem:
            itemUnique: true
            shared: "Reference value"
            refUnique: true
    

    Inline definitions will pick-up the same behavior.

    Reviewed by petougao at 2014-10-22 14:16
  • 3. Added pipe for multiline string, which makes them much more readable

    I made this little change because I am converting a LOT of data into Yaml from a database, and I wanted to make sure that the data as as user-friendly as possible.

    I asked this on SO: http://stackoverflow.com/questions/34805558/phps-yaml-deciding-how-to-generate-multiline-strings

    Then I discovered your wonderful YAML module, which makes much better YAML than PHP's (at least in terms of user readibility) AND it was reallllyyyy easy to hack to add this simple feature (this tells you something about the quality of your code).

    Disclaimer: I don't even know PHP. I am a nodeJS boy. But, I think the patch works, and I think it's worthwhile having.

    Note: I am not sure how it should deal with \n so that it's actually compatible with any Windows etc. If you feel this is a good addition, let me know and I will try and make it more generic...

    Reviewed by mercmobily at 2016-01-15 07:48
  • 4. Support "!!binary" syntax (decodes base64 string).

    Only supported in folded-scalar (lines ending with | or >) form, or inline form.

    Example Yaml: items

    name_enc: !!binary "SGVsbG8sIHdvcmxkLg=="
    desc_enc: !!binary |
        SGVsbG8sIH
        dvcmxkLg==
    
    Reviewed by johnnytemp at 2015-05-21 08:47
  • 5. fixed document start bug

    According to the YAML 1.2 specs section 2.2 Structures, the Examples 2.7 and 2.8 show that the document start --- and end ... can have content (such as whitespaces and comments) before and after respectively.

    The current implementation of cleanup() does not clean up the document start marker --- if the marker is placed after comments. As a result, the Parser will throw an exception.

    However, in this hotfix, I've changed the regular expression in the cleanup() process such that as long as that line contains --- or ... only, we remove it.

    If the markers are not used, then the usage is not affected.

    Reviewed by mauris at 2013-04-13 17:04
  • 6. Making the parser stateless.

    Currently if you parse multiple files with the same Parser instance, you get different results in the error reporting since the parser doesn't reset the offset.

    How to reproduce

    <?php
    include "vendor/autoload.php";
    
    use Symfony\Component\Yaml\Parser;
    
    
    $yamlString = "# translations/messages.en.yaml
    
    sylius:
        form:
            catalog_promotion:
                action:
                    fixed_price: 'Fixed price'
    ";
    
    $yaml = new Parser();
    $yaml->parse($yamlString);
    $yaml->parse($yamlString);
    try {
    $yaml->parse("abc:
    	abc");
    } catch (\Exception $e) {
    	echo $e->getMessage();
    	// Returns: A YAML file cannot contain tabs as indentation at line 4 (near "	abc")
    	// This is incorrect because the error is on line 2.
    	// Adding more calls to $yaml->parse($yamlString) will mess with the error reporting even more
    }
    
    Reviewed by mamazu at 2022-01-23 21:52
  • 7. Subarray of sequential array must be inline

    Hello,

    As I investigated this issue, I noticed this rule which seems to me implicit. Here is the most surgical changes to obtain the expected result without break the existing output.

    I have adding phpunit into project and update tests to remove coming deprecations of phpunit, because this is not bundled, and I have started the tests with my local phpunit (8).

    Reviewed by JJarrie at 2019-05-29 11:30
  • 8. RFC: Issue with nested string blocks that contain hashes.

    Adding this failing test to demonstrate the issue I'm seeing. I'm afraid a fix has me puzzled for the moment.

    Lines starting with a hash, within deeply-nested string blocks, are stripped from the parsed output.

    Lines starting with a hash within top-level string blocks are parsed correctly and end up in the output.

    So

    my:
        nested:
            block: |
                This is a bit
                # of text
                as an example
    

    Will parse to

    array(
        'my' => array(
            'nested' => array(
                'block' => "This is a bit\nas an example\n"
            )
        )
    )
    

    But it should be

    array(
        'my' => array(
            'nested' => array(
                'block' => "This is a bit\n# of text\nas an example\n"
            )
        )
    )
    

    But

    stuff:|
        Something that
        # works well
    

    Parses to

    array('stuff' => "Something that\n# works well");
    

    ...as far as I can tell.

    Make sense?

    Thanks.

    Reviewed by jezhalford at 2015-02-19 16:40
  • 9. added ability for substitute aliases when mapping is on single line

    At present parser only substitutes aliases when mapping is in a multiline. When the alias is used in the mapping stored in a single line, alias substitution doesn't work.

    So I modified Parser to fix it.

    Reviewed by nexGN at 2014-07-24 09:01
  • 10. ParseException "Indentation problem...“

    keyname1: value1     subkeyname1: a value     subkeyname2:                                 <----Must leave blank here, if previous line-value is empty!! keyname2: value2


    keyname1: value1     subkeyname1: a value     subkeyname2: keyname2: value2

    catch ParseException "Indentation problem."

    Reviewed by ericdplau at 2013-03-11 12:56
  • 11. Fix bug : dump float value in a context where locale sets comma as separator instead of dot

    For example, if LC_ALL is set to fr_FR then float number got ',' as separator ; example : 4,75

    In order to follow Yaml Specifications (http://yaml.org/type/float.html) we must replace the comma with a dot, and specify the float type.

    Code to reproduce the bug :

    
    <?php
    setlocale(LC_ALL, 'fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8');
    require_once dirname(__FILE__) . '/symfony/src/Symfony/Component/Yaml/Escaper.php';
    require_once dirname(__FILE__) . '/symfony/src/Symfony/Component/Yaml/Unescaper.php';
    require_once dirname(__FILE__) . '/symfony/src/Symfony/Component/Yaml/Inline.php';
    require_once dirname(__FILE__) . '/symfony/src/Symfony/Component/Yaml/Dumper.php';
    require_once dirname(__FILE__) . '/symfony/src/Symfony/Component/Yaml/Parser.php';
    
    $tab = array('value' => round(54 / 72, 4));
    
    var_dump($tab);
    
    $dumper = new Symfony\Component\Yaml\Dumper();
    $dump = $dumper->dump($tab, 1);
    
    var_dump($dump);
    
    $parser = new Symfony\Component\Yaml\Parser();
    $parsed = $parser->parse($dump);
    
    var_dump($parsed);
    
    assert($parsed === $tab);
    
    
    Reviewed by romainneutron at 2011-10-28 13:15
Quickly and easily expose Doctrine entities as REST resource endpoints with the use of simple configuration with annotations, yaml, json or a PHP array.

Drest Dress up doctrine entities and expose them as REST resources This library allows you to quickly annotate your doctrine entities into restful res

Jan 27, 2022
Monorepo of the PoP project, including: a server-side component model in PHP, a GraphQL server, a GraphQL API plugin for WordPress, and a website builder
Monorepo of the PoP project, including: a server-side component model in PHP, a GraphQL server, a GraphQL API plugin for WordPress, and a website builder

PoP PoP is a monorepo containing several projects. The GraphQL API for WordPress plugin GraphQL API for WordPress is a forward-looking and powerful Gr

May 8, 2022
The server component of API Platform: hypermedia and GraphQL APIs in minutes

API Platform Core API Platform Core is an easy to use and powerful system to create hypermedia-driven REST and GraphQL APIs. It is a component of the

May 20, 2022
Fork of Symfony Rate Limiter Component for Symfony 4

Rate Limiter Component Fork (Compatible with Symfony <=4.4) The Rate Limiter component provides a Token Bucket implementation to rate limit input and

Apr 19, 2022
The PasswordHasher component provides password hashing utilities.

PasswordHasher Component The PasswordHasher component provides secure password hashing utilities. Getting Started $ composer require symfony/password-

May 16, 2022
Enter-to-the-Matrix-with-Symfony-Console - Reproduction of the "Matrix characterfall" effect with the Symfony Console component.
Enter-to-the-Matrix-with-Symfony-Console - Reproduction of the

Enter to the Matrix (with Symfony Console) Reproduction of the "Matrix characterfall" effect with the Symfony Console component. Run Clone the project

May 12, 2022
Http-kernel - The HttpKernel component provides a structured process for converting a Request into a Response.

HttpKernel Component The HttpKernel component provides a structured process for converting a Request into a Response by making use of the EventDispatc

May 19, 2022
The BrowserKit component simulates the behavior of a web browser

BrowserKit Component The BrowserKit component simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms

May 19, 2022
Proxy files for DotNet, Java and PHP.

Best practices We don't recommend using this resource proxy. It is not being maintained and there's been no active development for many years. There a

Apr 15, 2022
A RESTful and extendable Backend as a Service that provides instant backend to develop sites and apps faster, with dead-simple integration for JavaScript, iOS, Android and more.

Welcome to hook ![Gitter](https://badges.gitter.im/Join Chat.svg) hook is a RESTful, extendable Backend as a Service that provides instant backend to

Mar 6, 2022
Online Book Store is a E-commerce Website and Book Conversion(pdf to audio and Img to txt) and Book Sharing platform.

Online-Book-Store Online Book Store is a E-commerce Website and Book Conversion(pdf to audio and Img to txt) and Book Sharing platform. The main descr

Apr 26, 2022
Simple and effective multi-format Web API Server to host your PHP API as Pragmatic REST and / or RESTful API

Luracast Restler ![Gitter](https://badges.gitter.im/Join Chat.svg) Version 3.0 Release Candidate 5 Restler is a simple and effective multi-format Web

May 5, 2022
A simple and flexible PHP middleware dispatcher based on PSR-7, PSR-11, and PSR-15

Woohoo Labs. Harmony Woohoo Labs. Harmony is a PSR-15 compatible middleware dispatcher. Harmony was born to be a totally flexible and almost invisible

Apr 27, 2022
A bundle providing routes and glue code between Symfony and a WOPI connector.

WOPI Bundle A Symfony bundle to facilitate the implementation of the WOPI endpoints and protocol. Description The Web Application Open Platform Interf

Apr 11, 2022
This API provides functionality for creating and maintaining users to control a simple To-Do-List application. The following shows the API structure for users and tasks resources.
This API provides functionality for creating and maintaining users to control a simple To-Do-List application. The following shows the API structure for users and tasks resources.

PHP API TO-DO-LIST v.2.0 This API aims to present a brief to consume a API resources, mainly for students in the early years of Computer Science cours

Apr 13, 2022
a tool to get Facebook data, and some Facebook bots, and extra tools found on Facebook Toolkit ++.
a tool to get Facebook data, and some Facebook bots, and extra tools found on Facebook Toolkit ++.

FACEBOOK TOOLKIT a tool to get Facebook data, and some Facebook bots, and extra tools found on Facebook Toolkit ++. Graph API Facebook. Made with ❤️ b

May 20, 2022
Create REST and GraphQL APIs, scaffold Jamstack webapps, stream changes in real-time.
Create REST and GraphQL APIs, scaffold Jamstack webapps, stream changes in real-time.

API Platform is a next-generation web framework designed to easily create API-first projects without compromising extensibility and flexibility: Desig

May 19, 2022
Simple utility and class library for generating php classes from a wsdl file.

wsdl2phpgenerator Simple WSDL to PHP classes converter. Takes a WSDL file and outputs class files ready to use. Uses the MIT license. Announcement: We

May 19, 2022
A simple PHP package for sending messages to Slack, with a focus on ease of use and elegant syntax.

Slack for PHP | A simple PHP package for sending messages to Slack with incoming webhooks, focused on ease-of-use and elegant syntax. supports: PHP 7.

May 15, 2022