Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Front Matter

Front Matter Laravel Package

webuni/front-matter

webuni/front-matter is a PHP library for extracting and parsing front matter from files. It separates metadata from content, supports YAML-style headers, and makes it easy to read Markdown front matter in PHP applications. Simple, lightweight, and framework-agnostic.

View on GitHub
Deep Wiki
Context7

Front matter parser and dumper for PHP

Frequently asked questions about Front Matter
How do I install webuni/front-matter in a Laravel application?
Install it with Composer using composer require webuni/front-matter. There is no Laravel service provider or facade, so integration is manual. Pin the exact version and run composer why-not against your Laravel and symfony/yaml constraints before adopting it.
Does webuni/front-matter support Laravel out of the box?
No. webuni/front-matter is a framework-agnostic PHP parser with no Laravel service provider, facade, or auto-discovery. Wrap it in an application-owned adapter or FrontMatterParser contract and bind that in a Laravel service provider. Keep the vendor API out of controllers, models, and Blade views.
How do I parse YAML front matter from a Markdown file in PHP?
Use the package to parse either a string or a file and receive a metadata plus content pair. The provided context does not document the exact array or object return shape, so confirm it in a technical spike. Wrap the call behind your own contract so callers do not depend directly on the vendor return type.
Can webuni/front-matter parse JSON front matter as well as YAML?
Yes. The package supports YAML and JSON metadata blocks and also allows custom parsers. Add fixtures for both formats and assert the extracted metadata shape in your adapter tests. Malformed JSON should be tested with the same fail-safe expectations as malformed YAML.
What happens when a Markdown file has no front matter?
The package is intended to return the document body when no front matter is present, but the exact return shape is not documented in the provided context. Add a fixture with no front matter and assert that the body is unchanged and metadata is empty. This should be part of your adapter contract tests before production use.
Is webuni/front-matter safe for parsing untrusted user content?
YAML parsing is the main security and operational risk. Test malformed YAML, anchors and aliases, object-like tags, duplicate keys, BOM, CRLF, and body-whitespace preservation. The provided context does not confirm which safe parsing flags are used, so verify that behavior and validate extracted metadata before persisting it.
How should I integrate webuni/front-matter into Laravel content imports?
Define an application-owned FrontMatterParser interface and bind it in a Laravel service provider. Use it in import commands, queued jobs, and content services, validate metadata with Laravel validators or a schema, and store metadata in a JSON column and body in a text column. Run chunked queued backfills with dry-run reporting and a rollback path.
Which PHP and symfony/yaml versions does webuni/front-matter require?
The repository metadata is unavailable in the provided context, so exact PHP and symfony/yaml constraints are unknown. Inspect composer show for the installed package and use composer why-not to check conflicts with your target Laravel version. Run CI against your supported Laravel and PHP matrix before adopting it.
How do I test front matter parsing for malformed, empty, and encoded documents?
Build fixtures for valid YAML, valid JSON, missing front matter, malformed YAML, empty documents, large files, BOM, CRLF, and unusual encodings. Put contract tests around your adapter and compare old-versus-new parser output on a representative sample before cutover. Ensure malformed input fails safely and no-front-matter input returns the body unchanged.
Is webuni/front-matter maintained, and what alternatives should I consider?
Adoption is small, around 40 stars, and repository metadata is unavailable, so vendor risk is moderate. Pin the exact version, monitor releases and security advisories, keep the adapter as the only integration point, and note that MIT licensing allows an internal fork if needed. If you already render Markdown with league/commonmark, evaluate its front matter extension, and compare spatie/yaml-front-matter as another YAML-focused option using your own fixtures.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource