PHPackages                             cable8mm/db-to-markdown - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. cable8mm/db-to-markdown

ActiveProject[Database &amp; ORM](/categories/database)

cable8mm/db-to-markdown
=======================

DB to markdown generator

v1.4.0(1mo ago)16MITPHPPHP ^8.0.2CI passing

Since Feb 23Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/cable8mm/db-to-markdown)[ Packagist](https://packagist.org/packages/cable8mm/db-to-markdown)[ RSS](/packages/cable8mm-db-to-markdown/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (9)Dependencies (18)Versions (10)Used By (0)

DB to markdown
==============

[](#db-to-markdown)

[![code-style](https://github.com/cable8mm/db-to-markdown/actions/workflows/code-style.yml/badge.svg)](https://github.com/cable8mm/db-to-markdown/actions/workflows/code-style.yml)[![run-tests](https://github.com/cable8mm/db-to-markdown/actions/workflows/run-tests.yml/badge.svg)](https://github.com/cable8mm/db-to-markdown/actions/workflows/run-tests.yml)[![Packagist Version](https://camo.githubusercontent.com/0e52ffc1793def82de26d3633ea9003332ecd7aa250a613ad84010ae80fd54ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6361626c65386d6d2f64622d746f2d6d61726b646f776e)](https://packagist.org/packages/cable8mm/db-to-markdown)[![Packagist Downloads](https://camo.githubusercontent.com/191d59f5b3933b5d8fc351b60b963194dfc2dff0f1f27ad2287580af7590b337/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6361626c65386d6d2f64622d746f2d6d61726b646f776e)](https://packagist.org/packages/cable8mm/db-to-markdown/stats)[![Packagist Dependency Version](https://camo.githubusercontent.com/f25665ab09638c5cb611d1b44cbe230e0a8651bbef610737a046552de07a155d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6361626c65386d6d2f64622d746f2d6d61726b646f776e2f706870)](https://packagist.org/packages/cable8mm/db-to-markdown)[![Packagist Dependency Version](https://camo.githubusercontent.com/7ce7c6f0460c205a9f073e68f191eccf0dc8d77a246a3a10f680fff7ddb74eae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6361626c65386d6d2f64622d746f2d6d61726b646f776e2f73796d666f6e79253246636f6e736f6c65)](https://camo.githubusercontent.com/7ce7c6f0460c205a9f073e68f191eccf0dc8d77a246a3a10f680fff7ddb74eae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6361626c65386d6d2f64622d746f2d6d61726b646f776e2f73796d666f6e79253246636f6e736f6c65)[![Packagist Stars](https://camo.githubusercontent.com/a7d478b7f9a7a9b0128ab5c0cdd3d63949eb4fe2c4d5f272ef75f92bf9ed8cf3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6361626c65386d6d2f64622d746f2d6d61726b646f776e)](https://github.com/cable8mm/db-to-markdown/stargazers)[![Packagist License](https://camo.githubusercontent.com/5f9e30959754d89ea5c588ebd62395b2a9615592cb95aee07855f5eb38293906/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6361626c65386d6d2f64622d746f2d6d61726b646f776e)](https://camo.githubusercontent.com/5f9e30959754d89ea5c588ebd62395b2a9615592cb95aee07855f5eb38293906/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6361626c65386d6d2f64622d746f2d6d61726b646f776e)

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  ❤️

Features
--------

[](#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)

[![Preview](https://github.com/cable8mm/cabinet/raw/main/db-to-markdown-preview.gif?raw=true)](https://github.com/cable8mm/cabinet/blob/main/db-to-markdown-preview.gif?raw=true)

Support &amp; Tested
--------------------

[](#support--tested)

VersionsPHP 8.2PHP 8.3PHP 8.4PHP 8.5Available✅✅✅✅Installation
------------

[](#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
-------------

[](#configuration)

### 1. Database Connection (`.env`)

[](#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`)

[](#2-table-mapping-db-to-markdownjson)

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
-----

[](#usage)

### Quick Start (SQLite Demo)

[](#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

[](#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

[](#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
------------------------------

[](#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
----------

[](#formatting)

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

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

Test
----

[](#test)

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

```
composer test
```

License
-------

[](#license)

The DB to markdown project is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance92

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~108 days

Recently: every ~214 days

Total

9

Last Release

41d ago

Major Versions

v0.0.1 → v1.0.02024-03-02

PHP version history (2 changes)v0.0.1PHP &gt;=8.2

v1.0.0PHP ^8.0.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/c910c874a0263a18f9f976273054cd45faa3ffbcba7891992f4ab52d0656dd93?d=identicon)[Sam Lee](/maintainers/Sam%20Lee)

---

Top Contributors

[![cable8mm](https://avatars.githubusercontent.com/u/2672043?v=4)](https://github.com/cable8mm "cable8mm (34 commits)")

---

Tags

astroconvertdatabasegatsbygeneratorjekyllmarkdownphpdatabaseimportcommandjekyll

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/cable8mm-db-to-markdown/health.svg)

```
[![Health](https://phpackages.com/badges/cable8mm-db-to-markdown/health.svg)](https://phpackages.com/packages/cable8mm-db-to-markdown)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.9k556.2M21.5k](/packages/laravel-framework)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.9M535](/packages/pimcore-pimcore)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k99.8M355](/packages/laravel-horizon)[lion/bundle

Lion-framework configuration and initialization package

132.4k5](/packages/lion-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9626.1k68](/packages/open-dxp-opendxp)[bitrix24/b24phpsdk

An official PHP library for the Bitrix24 REST API

10250.3k6](/packages/bitrix24-b24phpsdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
