pushword/flat-file
Composer 安装命令:
composer require pushword/flat-file
包简介
Transform Pushword in a FlatFile CMS.
README 文档
README
Turn Pushword into a flat-file CMS — pages and media stored as Markdown + CSV on disk, round-tripped with the database and trackable in Git.
Features
- Two-way
pw:flat:syncbetween Markdown/CSV files and the database. - Auto-export after admin edits, optional auto git commit.
- Conflict resolution, editorial locks and webhook locking.
- Optional user sync (
users.yaml) and conversation sync.
Installation
composer require pushword/flat
Documentation
Visit pushword.piedweb.com/extension/flat.
Sync flow (pw:flat:sync)
flowchart TD
Start([pw:flat:sync]) --> LockCheck{Webhook Lock?}
LockCheck -->|Oui| Blocked[Sync bloquée]
LockCheck -->|Non| MediaCheck{MediaSync}
MediaCheck -->|Fichiers plus récents| MediaImport[IMPORT Médias]
MediaCheck -->|DB plus récente| MediaExport[EXPORT Médias]
MediaImport --> MI1[1. Parser index.csv]
MI1 --> MI2[2. Valider fichiers + préparer renommages]
MI2 --> MI3[3. Supprimer médias absents du CSV]
MI3 --> MI4[4. Importer fichiers mediaDir + contentDir/media]
MI4 --> MI5[5. Régénérer index.csv]
MI5 --> PageCheck
MediaExport --> ME1[Écrire index.csv + copier fichiers]
ME1 --> PageCheck
PageCheck{PageSync} -->|Fichiers plus récents| PageImport[IMPORT Pages]
PageCheck -->|DB plus récente| PageExport[EXPORT Pages]
PageImport --> PI1[1. Importer redirection.csv]
PI1 --> PI2[2. Importer fichiers .md]
PI2 --> PI3[3. finishImport - relations]
PI3 --> PI4[4. Supprimer pages orphelines]
PI4 --> PI5[5. Régénérer index.csv]
PI5 --> ConvCheck
PageExport --> PE1[Écrire .md + index.csv + redirection.csv]
PE1 --> ConvCheck
ConvCheck{ConversationSync?} -->|Activé| ConvSync[Sync Conversations]
ConvCheck -->|Non| UserCheck
ConvSync --> UserCheck
UserCheck{UserSync?} -->|Activé| UserSync[Sync users.yaml ↔ DB]
UserCheck -->|Non| End
UserSync --> End([Fin])
Blocked --> EndBlocked([Échec])
style Start fill:#e1f5ff
style MediaImport fill:#fff4e1
style PageImport fill:#fff4e1
style MediaExport fill:#e1ffe1
style PageExport fill:#e1ffe1
style End fill:#e1f5ff
style Blocked fill:#ffcccc
style EndBlocked fill:#ffcccc
Loading
Détails du processus
Webhook Lock
Avant toute synchronisation, le système vérifie si un webhook lock est actif. Ce verrou est utilisé pendant les workflows d'édition externe (ex: CI/CD) pour éviter les conflits.
Décision Import/Export
PageSync et MediaSync déterminent indépendamment la direction :
- MediaSync : Compare le hash SHA1 des fichiers avec
Media->getHash()en DB - PageSync : Compare
filemtime()avecPage->getUpdatedAt(), avec gestion des conflits viaConflictResolver
Import Médias (Fichiers → DB)
- Parser
index.csv- Charge les métadonnées (id, fileName, name, alt, projectDir) - Valider fichiers - Vérifie l'existence des fichiers référencés
- Préparer renommages - Détecte les fichiers renommés via leur ID
- Supprimer médias orphelins - Supprime les médias en DB absents du CSV
- Importer fichiers - Depuis
mediaDiretcontentDir/media - Régénérer
index.csv- Reflète l'état final de la DB
Import Pages (Fichiers → DB)
- Importer
redirection.csv- Charge les redirections - Importer fichiers
.md- Parse le front matter YAML + contenu markdown - finishImport - Résout les relations (parentPage, mainImage, translations)
- Supprimer pages orphelines - Pages en DB sans fichier
.mdni entrée redirection - Régénérer
index.csv- Avec les IDs auto-générés
Export (DB → Fichiers)
Pages :
- Écrit
{slug}.mdavec front matter YAML - Génère
index.csv(métadonnées) etredirection.csv
Médias :
- Écrit
index.csvavec les métadonnées - Copie les fichiers si
copyMediaest configuré
UserSync (optionnel)
Synchronisation bidirectionnelle entre config/users.yaml et la DB :
- Exporte les utilisateurs DB manquants vers le YAML
- Importe/met à jour les utilisateurs depuis le YAML
- Les mots de passe restent uniquement en DB
ConversationSync (optionnel)
Interface pour synchroniser les conversations (implémenté par le package conversation)
The Pushword ecosystem
Pushword is a modular CMS — one Symfony bundle for the core and one bundle per feature. Pick only what you need:
Core
- pushword/core — Symfony-based CMS core: Page, Media & User entities, Markdown + Twig rendering.
Editing & admin
- pushword/admin — EasyAdmin interface to manage pages, media and users.
- pushword/admin-block-editor — Gutenberg-like block editor (stores Markdown).
- pushword/advanced-main-image — Hero images & main-image format control.
- pushword/template-editor — Edit Twig templates online.
- pushword/snippet — Reusable content fragments & components.
Content & workflow
- pushword/flat — Flat-file (Markdown + Git) CMS mode. (this package)
- pushword/version — Page & snippet versioning.
- pushword/page-update-notifier — Email alerts on content changes.
- pushword/conversation — Comments, contact & newsletter forms.
Publishing & performance
- pushword/static-generator — Export a static website (GitHub Pages, Apache, FrankenPHP).
- pushword/search — SQLite full-text search (Loupe), zero infra.
- pushword/page-scanner — Find dead links, 404s, redirects & TODOs.
- pushword/api — Token-authenticated REST API.
Tooling
- pushword/installer — Project & package installer.
- pushword/js-helper — Front-end JavaScript helpers.
Full list and guides on pushword.piedweb.com/extensions.
Contributing
If you're interested in contributing to Pushword, please read our contributing docs before submitting a pull request.
Credits
License
The MIT License (MIT). Please see License File for more information.
pushword/flat-file 适用场景与选型建议
pushword/flat-file 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 207 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 12 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pushword/flat-file 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pushword/flat-file 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pushword/flat-file 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This module allows drag & drop grouping of items in a GridField
Adds text size controls and text-to-speech controls to Flarum discussion content.
Native Blade date, datetime, and date range pickers.
Symfony and Flysystem integration for the maintained KCFinder continuation.
Laravel integration for the maintained KCFinder continuation.
PHPStan rules shared across KnpLabs organization projects
统计信息
- 总下载量: 207
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-29