承接 cable8mm/db-to-markdown 相关项目开发

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

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

cable8mm/db-to-markdown

Composer 安装命令:

composer create-project cable8mm/db-to-markdown

包简介

DB to markdown generator

README 文档

README

code-style run-tests Packagist Version Packagist Downloads Packagist Dependency Version Packagist Dependency Version Packagist Stars Packagist License

This tool generates Markdown files from a database table. It supports multiple output formats including Jekyll, Astro, Gatsby, or any custom format you create.

We have provided the API Documentation on the web. For more information, please visit https://www.palgle.com/db-to-markdown/ ❤️

Features

  • Any schema can generate Markdown in any desired format
  • Effortlessly incorporate your custom mapper and command
  • Implement callback body and datetime functionality
  • Database testing is supported

Preview

Preview

Support & Tested

Versions PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
Available

Installation

composer create-project cable8mm/db-to-markdown

After installation, run the init command to create the required configuration files:

php bin/console init
# Creates .env and db-to-markdown.json from their example templates

Configuration

1. Database Connection (.env)

Copy .env.example to .env and configure your database connection:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=your_database
DB_USERNAME=root
DB_PASSWORD=password
DB_PORT=3306

If .env is not provided, SQLite is used by default with database/database.sqlite. You can customize the SQLite path by setting DB_DATABASE in your .env file. To skip database configuration entirely, leave .env out and use php bin/console seeding to seed the built-in SQLite database.

2. Table Mapping (db-to-markdown.json)

Configure your table structure and field mapping in db-to-markdown.json:

{
  "table": "posts",
  "author": "Your Name",
  "category_labels": {
    "1": "Category One",
    "2": "Category Two"
  },
  "map": {
    "title": ["title", "subtitle"],
    "slug": "id",
    "categories": "category_id",
    "body": "content",
    "published_at": "published_at"
  }
}

Field Descriptions:

  • table: Your database table name
  • author: Default author name (used if author field is empty)
  • category_labels: Maps category IDs to display names (optional)
  • map.title: Column(s) for the article title (string or array)
  • map.slug: Column for the URL slug
  • map.categories: Column for category mapping
  • map.body: Column containing HTML content (converted to Markdown)
  • map.published_at: Published date column

Usage

Quick Start (SQLite Demo)

# Initialize configuration files
php bin/console init

# Seed demo data into the built-in SQLite database
php bin/console seeding

# Generate Markdown files
php bin/console create-md
# or for Jekyll format:
php bin/console create-jekyll

Available Commands

# Generate standard Markdown files in dist/
php bin/console create-md

# Generate Jekyll-compatible Markdown with YAML front matter
php bin/console create-jekyll

# Clear all generated files in dist/
php bin/console clean

# Initialize configuration files from examples
php bin/console init

# Seed demo data for testing
php bin/console seeding

Command Options

php bin/console create-md --dry-run
# Shows how many files would be generated without writing them

php bin/console create-md --limit=5
# Process only 5 records

php bin/console create-md --limit=10 --offset=20
# Process 10 records starting from offset 20

How to Develop Custom Commands

  1. Run init to create configuration files, or create them manually:

    • .env for database credentials
    • db-to-markdown.json for table/field mapping
  2. Create a mapper in src/Mappers/ to define your table field mapping (see existing examples).

  3. Create a format in src/Formats/ to define how output files are rendered (Markdown, Jekyll, etc.).

  4. Create a command in src/Command/ extending BaseCommand or implementing your own logic.

  5. Register your command in bin/console.

Formatting

composer lint
# Modify all files to comply with the PSR-12.

composer inspect
# Inspect all files to ensure compliance with PSR-12.

Test

It uses the built-in SQLite database, not your own database. It will never cause harm to your data.

composer test

License

The DB to markdown project is open-sourced software licensed under the MIT license.

cable8mm/db-to-markdown 适用场景与选型建议

cable8mm/db-to-markdown 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 03 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-02