The Yaml component loads and dumps YAML files.

Overview
Comments
  • Nested merge keys

    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

    opened by mathroc 4
  • Proper inheritance when merging references and inline

    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.

    opened by petougao 4
  • Added pipe for multiline string, which makes them much more readable

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

    opened by mercmobily 2
  • Support

    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==
    
    opened by johnnytemp 2
  • fixed document start bug

    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.

    opened by mauris 2
  • Making the parser stateless.

    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
    }
    
    opened by mamazu 1
  • Subarray of sequential array must be inline

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

    opened by JJarrie 1
  • RFC: Issue with nested string blocks that contain hashes.

    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.

    opened by jezhalford 1
  • added ability for substitute aliases when mapping is on single line

    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.

    opened by nexGN 1
  • ParseException

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

    opened by ericdplau 1
  •  Fix bug : dump float value in a context where locale sets comma as separator instead of dot

    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);
    
    
    opened by romainneutron 1
Releases(v6.1.9)
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

Lee Davis 88 Nov 5, 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

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

Leonardo Losoviz 265 Jan 7, 2023
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

API Platform 2.2k Dec 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

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

Leonardo Losoviz 265 Jan 7, 2023
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

AvaiBook by idealista 4 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-

Symfony 482 Dec 29, 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 "Matrix characterfall" effect with the Symfony Console component. Run Clone the project

Yoan Bernabeu 23 Aug 28, 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

Symfony 7.8k Jan 9, 2023
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

Symfony 2.7k Dec 29, 2022
Stepup Middleware - This component is part of "Step-up Authentication as-a Service".

Step-up Middleware This component is part of "Step-up Authentication as-a Service". See Stepup-Deploy for an overview and installation instructions fo

OpenConext 4 Nov 2, 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

Esri 364 Dec 24, 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

doubleleft 762 Dec 30, 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

Gokul krishnan 1 May 22, 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

Luracast 1.4k Dec 14, 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

Woohoo Labs. 153 Sep 5, 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

Champs-Libres 5 Aug 20, 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.

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

Edson M. de Souza 6 Oct 13, 2022
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

Wahyu Arif Purnomo 569 Dec 27, 2022
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

API Platform 7.7k Jan 7, 2023