承接 jbzoo/markdown 相关项目开发

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

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

jbzoo/markdown

Composer 安装命令:

composer require jbzoo/markdown

包简介

Tools to render markdown text from PHP code

README 文档

README

CI Coverage Status Psalm Coverage Psalm Level CodeFactor Stable Version Total Downloads Dependents GitHub License

Tools to render markdown text from PHP code. This library provides a simple and fluent API for generating markdown elements programmatically, including tables with advanced formatting options.

Features

  • Markdown Elements: Generate links, titles, images, badges, blockquotes, spoilers, and code blocks
  • Advanced Tables: Create markdown tables with auto-indexing, custom alignments, and flexible rendering
  • Type Safety: Full PHP 8.2+ compatibility with strict typing
  • Fluent API: Chainable methods for intuitive table building
  • Zero Dependencies: Lightweight with minimal external requirements

Requirements

  • PHP 8.2 or higher
  • Composer

Installing

composer require jbzoo/markdown

Usage

Table Generation

<?php declare(strict_types=1);

use JBZoo\Markdown\Table;

echo (new Table())
    ->addAutoIndex('Index', 999)
    ->setHeaders(['Header #1', 'Header #2'])
    ->setAlignments([Table::ALIGN_CENTER, Table::ALIGN_RIGHT])
    ->appendRow(['123', '456'])
    ->appendRows([
        ['789_1', '9871'],
        ['789_2', '']
    ])
    ->render();

Result

| Index | Header #1 | Header #2 |
|------:|:---------:|----------:|
|   999 |    123    |       456 |
|  1000 |   789_1   |      9871 |
|  1001 |   789_2   |           |
See Live Example
Index Header #1 Header #2
999 123 456
1000 789_1 9871
1001 789_2

Markdown Elements

<?php declare(strict_types=1);

use JBZoo\Markdown\Markdown;

// Page Navigation
echo Markdown::title('Page Name', 1);    // # Page Name\n
echo Markdown::title('Title', 2);        // ## Title\n
echo Markdown::title('Sub Title', 3);    // ### Sub Title\n

// Links
echo Markdown::url('Google', 'https://google.com');
// Output: [Google](https://google.com)

// Badges
echo Markdown::badge('Status', 'https://travis-ci.org/badge.svg', 'https://travis-ci.org/');
// Output: [![Status](https://travis-ci.org/badge.svg)](https://travis-ci.org/)

// Images
echo Markdown::image('https://example.com/logo.jpg', 'Logo');
// Output: ![Logo](https://example.com/logo.jpg)

// Blockquotes
echo Markdown::blockquote(['Quote Line 1', 'Quote Line 2', 'Quote Line 3']);
// Output:
// > Quote Line 1
// > Quote Line 2
// > Quote Line 3

// Spoiler (collapsible content)
echo Markdown::spoiler('Click to expand', 'Hidden content here');
// Output:
// <details>
//   <summary>Click to expand</summary>
//
//   Hidden content here
//
// </details>

// Code blocks
echo Markdown::code("<?php\necho 'Hello World';\n", 'php');
// Output:
// ```php
// <?php
// echo 'Hello World';
//
// ```

Table Features

The Table class supports various advanced features:

<?php declare(strict_types=1);

use JBZoo\Markdown\Table;

// Basic table
$table = new Table();
$table->setHeaders(['Name', 'Age', 'City'])
      ->appendRow(['John', '25', 'New York'])
      ->appendRow(['Jane', '30', 'London']);

echo $table->render();

// Table with alignments
$table = new Table();
$table->setHeaders(['Left', 'Center', 'Right'])
      ->setAlignments([Table::ALIGN_LEFT, Table::ALIGN_CENTER, Table::ALIGN_RIGHT])
      ->appendRow(['Text', 'Text', 'Text']);

echo $table->render();

// Table with auto-indexing
$table = new Table();
$table->addAutoIndex('#', 1)
      ->setHeaders(['Item', 'Price'])
      ->appendRows([
          ['Apple', '$1.00'],
          ['Banana', '$0.50'],
          ['Orange', '$0.75']
      ]);

echo $table->render();

Development

Setup

make update          # Install/update dependencies

Testing

make test           # Run PHPUnit tests
make test-all       # Run all tests and code quality checks
make codestyle      # Run linters and code style checks

Available Make Targets

Run make help to see all available commands including:

  • Code quality tools (PHPStan, Psalm, PHPCS, etc.)
  • Performance testing
  • Report generation
  • Build tools

License

MIT

jbzoo/markdown 适用场景与选型建议

jbzoo/markdown 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.08M 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 11 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「text」 「markdown」 「Rendering」 「readme」 「jbzoo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 jbzoo/markdown 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jbzoo/markdown 我们能提供哪些服务?
定制开发 / 二次开发

基于 jbzoo/markdown 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.08M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 27
  • 依赖项目数: 5
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-03