{"id":17797380,"url":"https://github.com/steevanb/php-yaml","last_synced_at":"2025-08-01T07:41:23.789Z","repository":{"id":57059376,"uuid":"85429891","full_name":"steevanb/php-yaml","owner":"steevanb","description":"Add some features to symfony/yaml","archived":false,"fork":false,"pushed_at":"2018-02-13T17:58:06.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-24T16:05:55.756Z","etag":null,"topics":["php","symfony"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steevanb.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-18T20:27:03.000Z","updated_at":"2019-10-18T12:01:44.000Z","dependencies_parsed_at":"2022-08-24T14:53:27.246Z","dependency_job_id":null,"html_url":"https://github.com/steevanb/php-yaml","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steevanb%2Fphp-yaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steevanb%2Fphp-yaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steevanb%2Fphp-yaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steevanb%2Fphp-yaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steevanb","download_url":"https://codeload.github.com/steevanb/php-yaml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229743831,"owners_count":18117460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","symfony"],"created_at":"2024-10-27T11:55:35.506Z","updated_at":"2024-12-14T19:10:01.375Z","avatar_url":"https://github.com/steevanb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![version](https://img.shields.io/badge/version-1.0.2-green.svg)](https://github.com/steevanb/php-yaml/tree/1.0.2)\n[![symfony](https://img.shields.io/badge/symfony/yaml-^3.1-blue.svg)](https://github.com/symfony/yaml)\n![Lines](https://img.shields.io/badge/code%20lines-214-green.svg)\n![Total Downloads](https://poser.pugx.org/steevanb/php-yaml/downloads)\n[![SensionLabsInsight](https://img.shields.io/badge/SensionLabsInsight-platinum-brightgreen.svg)](https://insight.sensiolabs.com/projects/00a42deb-03af-40da-a61f-b8abdd3a90b3/analyses/9)\n[![Scrutinizer](https://scrutinizer-ci.com/g/steevanb/php-yaml/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/steevanb/php-yaml/)\n\nphp-yaml\n========\n\nAdd features to [symfony/yaml](https://github.com/symfony/yaml).\n\nAs _steevanb\\PhpYaml\\Parser_ extends _Symfony\\Component\\Yaml\\Parser_,\nyou have all Symfony YAML parser features.\n\n[Changelog](changelog.md)\n\nInstallation\n------------\n\nUse _composer require_ :\n```bash\ncomposer require steevanb/php-yaml ^1.0\n```\n\nOr add it manually to _composer.json_ :\n```yaml\n{\n    \"require\": {\n        \"steevanb/php-yaml\": \"^1.0\"\n    }\n}\n```\n\nHow to use\n----------\n\nInstead of calling _Symfony\\Component\\Yaml\\Yaml::parse($content)_, you have to do this :\n```php\nuse steevanb\\PhpYaml\\Parser;\n$parser = new Parser();\n$parser-\u003eparse(file_get_contents('foo.yml'));\n```\n\nFunction support\n----------------\n\nYou can call registered functions in yaml value :\n````yaml\nfoo:\n    call_file_get_contents: \u003cfile('baz.txt')\u003e\n    call_new_DateTime: \u003cdate()\u003e\n    call_new_DateTime2: \u003cdate('2017-12-31')\u003e\n````\nBy default, no function is registered into Parser. You need to manually register every function you need.\n\nYou can register _\u003cfile($fileName)\u003e_ function. _$path_ is _$fileName_ path prefix :\n```php\nsteevanb\\PhpYaml\\Parser::registerFileFunction($path = null);\n```\n\nYou can register _\u003cdate($format = null)\u003e_ function :\n```php\nsteevanb\\PhpYaml\\Parser::registerDateFunction();\n```\n\nYou can register your own function :\n```php\nsteevanb\\PhpYaml\\Parser::registerFunction('foo', function($bar, $baz) {\n    return $bar + $baz;\n});\n```\nAnd call it in yaml :\n```yaml\nfoo:\n    bar: \u003cfoo(41, 1)\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteevanb%2Fphp-yaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteevanb%2Fphp-yaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteevanb%2Fphp-yaml/lists"}