Query Markdown Content with Eloquent in Laravel: Filtering, Sorting, and Pagination The developer behind the open-source Fusion package released a Laravel library that exposes Markdown files with YAML Frontmatter as Eloquent models, letting developers filter, sort, and paginate file-based content with familiar methods like where(), orderBy(), and paginate(). Fusion parses Frontmatter into model attributes, derives slugs from filenames unless overridden, and adds caching plus a fusion:check --validate command for enforcing Frontmatter rules. The package targets documentation and knowledge collections that need querying by metadata such as section or order. Markdown is common in documentation, project knowledge bases, website content, and instructions for AI coding tools. If your code needs to load one Markdown file and already knows its path, that is straightforward. The challenge appears when content becomes a collection, for example, documentation split across many chapter and section files. Markdown describes the body of each file, but a collection also needs structured information to identify and organize its content. A common way to add it is YAML Frontmatter: a small block at the beginning of a Markdown file, enclosed by --- , with fields such as title , section , order , or published . For example, section: installation lets the application identify which part of the documentation a file belongs to, while order: 2 can define its position within that section. Once files have this metadata, the application needs a way to query it, to retrieve the whole collection or a relevant subset, such as all installation sections or the chapters in one guide, sorted in the intended order. Without a query layer, the application has to scan files, parse Frontmatter, and implement filtering and sorting itself. Fusion gives Laravel developers a familiar way to work with that content. It exposes Markdown files as Eloquent models, so you can use the same methods you already know from database-backed models where , orderBy , and paginate without learning a separate query API. Your Markdown remains the source of truth; Fusion handles parsing Frontmatter and rendering the content so you can retrieve it through Eloquent. This guide builds a practical article collection and shows how to configure its content folder, query it, and use Fusion's caching and content checks. Install Fusion with Composer: composer require hi-folks/fusion A simple content collection can live under resources/content/article . Each file contains YAML Frontmatter for structured values and Markdown for the body: --- title: Working with Markdown in Laravel date: "2026-10-19" published: true category: laravel excerpt: A practical guide to querying file-based content. --- Working with Markdown in Laravel This article is stored as a Markdown file and can be retrieved through Eloquent. Fusion uses each Markdown filename without its extension as the slug when the Frontmatter has no slug key. You can set a slug value in Frontmatter when the URL should differ from the file name. Avoid setting slug to an empty or null value: because the key is present, Fusion treats it as an explicit override instead of falling back to the filename. This format is useful when content should be reviewed in Git, edited with any Markdown editor, or kept alongside application code. It also works for curated documentation and knowledge collections, including material that developers or AI coding tools need to retrieve by category or metadata. Create a model for the article content directory and use Fusion's trait. The frontmatterFields method lists the Frontmatter keys that Fusion should load as model attributes: php