承接 labrodev/laravel-markdownable 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

labrodev/laravel-markdownable

最新稳定版本:v1.0.0

Composer 安装命令:

composer require labrodev/laravel-markdownable

包简介

Read Markdown files with YAML front matter, convert to HTML, and expose page data.

README 文档

README

Read Markdown files with YAML front matter, convert to HTML, and expose structured page data.

Features

  • MarkdownPageFileReader — Read .md files by slug, list pages, resolve paths.
  • FrontMatterParser — Parse YAML front matter and body (Spatie YAML Front Matter).
  • MarkdownToHtmlConverter — Convert Markdown to HTML (League CommonMark, GFM).
  • MarkdownPageReader — Orchestrator: read → parse → convert → return PageData.
  • PageData — Readonly value object with slug, title, meta fields, body, bodyHtml; toArray() for views/SEO.
  • ContractsMarkdownPageFileReaderContract, FrontMatterParserContract, MarkdownConverterContract for type-hinting and swapping implementations or mocks.
  • Markdownable facade — Static access to the page reader.

Installation

composer require labrodev/laravel-markdownable

The service provider is registered automatically.

Configuration

The package uses config('site.content.paths.pages') by default for the pages directory. To override, publish the config or set MARKDOWNABLE_PAGES_PATH in your .env.

php artisan vendor:publish --tag=markdownable-config

Usage

use Labrodev\Markdownable\Facades\Markdownable;

$page = Markdownable::getPageBySlug('about');
if ($page !== null) {
    $page->title;       // string
    $page->bodyHtml;    // string (HTML)
    $page->toArray();   // array for Blade/SEO (slug, title, meta_title, meta_description, og_image, sitemap, canonical, body, body_html)
}

Use PageData::toArray() when passing to Blade or SEO so keys match the usual array shape (meta_title, meta_description, og_image, body_html, etc.).

Development

cd package/laravel-markdownable
composer install
composer run test      # Pest
composer run pint      # Lint (read-only)
composer run pint:fix  # Format
composer run stan      # PHPStan
composer run analysis  # Pint fix + PHPStan

统计信息

  • 总下载量: 57
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固