{"id":13584647,"url":"https://github.com/spatie/yaml-front-matter","last_synced_at":"2025-04-08T10:29:32.123Z","repository":{"id":41142820,"uuid":"49602961","full_name":"spatie/yaml-front-matter","owner":"spatie","description":"A to the point yaml front matter parser","archived":false,"fork":false,"pushed_at":"2023-12-04T10:03:30.000Z","size":68,"stargazers_count":322,"open_issues_count":0,"forks_count":28,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-05-01T11:46:13.554Z","etag":null,"topics":["formatting","php","yaml"],"latest_commit_sha":null,"homepage":"https://spatie.be/opensource/php","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spatie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"spatie","custom":"https://spatie.be/open-source/support-us"}},"created_at":"2016-01-13T21:26:46.000Z","updated_at":"2024-05-16T04:16:29.694Z","dependencies_parsed_at":"2024-05-16T04:16:21.538Z","dependency_job_id":"82cafa5a-4e40-4b42-ad36-54b67e35f2a4","html_url":"https://github.com/spatie/yaml-front-matter","commit_stats":{"total_commits":84,"total_committers":22,"mean_commits":"3.8181818181818183","dds":0.6904761904761905,"last_synced_commit":"0798f89abcc5baf4d4f0a0e86353f74e2232c447"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fyaml-front-matter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fyaml-front-matter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fyaml-front-matter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fyaml-front-matter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/yaml-front-matter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247823269,"owners_count":21002045,"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":["formatting","php","yaml"],"created_at":"2024-08-01T15:04:24.937Z","updated_at":"2025-04-08T10:29:32.106Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":["https://github.com/sponsors/spatie","https://spatie.be/open-source/support-us"],"categories":["PHP"],"sub_categories":[],"readme":"\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/support-ukraine.svg?t=1\" /\u003e](https://supportukrainenow.org)\n\n# yaml-front-matter\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/yaml-front-matter.svg?style=flat-square)](https://packagist.org/packages/spatie/yaml-front-matter)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/spatie/yaml-front-matter/master.svg?style=flat-square)](https://travis-ci.org/spatie/yaml-front-matter)\n[![Quality Score](https://img.shields.io/scrutinizer/g/spatie/yaml-front-matter.svg?style=flat-square)](https://scrutinizer-ci.com/g/spatie/yaml-front-matter)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/yaml-front-matter.svg?style=flat-square)](https://packagist.org/packages/spatie/yaml-front-matter)\n\nA to the point front matter parser. Front matter is metadata written in yaml, located at the top of a file wrapped in `---`'s.\n\n```md\n---\ntitle: Example\n---\n\nLorem ipsum.\n```\n\n```php\nuse Spatie\\YamlFrontMatter\\YamlFrontMatter;\n\n$object = YamlFrontMatter::parse(file_get_contents(__DIR__.'/example.md'));\n\n$object-\u003ematter('title'); // =\u003e 'Example';\n$object-\u003ebody(); // =\u003e 'Lorem ipsum.'\n\n// Or retrieve front matter with a property call...\n\n$object-\u003etitle; // =\u003e 'Example';\n```\n\nSpatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/yaml-front-matter.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/yaml-front-matter)\n\nWe invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).\n\n## Install\n\nYou can install the `yaml-front-matter` via composer:\n\n``` bash\n$ composer require spatie/yaml-front-matter\n```\n\n## Usage\n\nConsider the `example.md` file from above. First you'll need to parse the contents:\n\n```php\nuse Spatie\\YamlFrontMatter\\YamlFrontMatter;\n$object = YamlFrontMatter::parse(file_get_contents('example.md'));\n```\n\nThe parser will return a `YamlFrontMatterObject`, which can be queried for front matter or it's body.\n\n```php\n$object-\u003ematter(); // =\u003e ['title' =\u003e 'Example']\n$object-\u003ematter('title'); // =\u003e 'Example'\n$object-\u003ebody(); // =\u003e 'Lorem ipsum.'\n$object-\u003etitle; // =\u003e 'Example'\n```\n\n**Protip**: The `matter` function also accepts dot notation for nested fields, e.g. `matter('meta.keywords')`.\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\n$ vendor/bin/phpunit\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security\n\nIf you've found a bug regarding security please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker.\n\n## Postcardware\n\nYou're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.\n\nOur address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.\n\nWe publish all received postcards [on our company website](https://spatie.be/en/opensource/postcards).\n\n## Credits\n\n- [Sebastian De Deyne](https://github.com/:author_username)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Fyaml-front-matter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Fyaml-front-matter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Fyaml-front-matter/lists"}