aichadigital/lara-content
Composer 安装命令:
composer require aichadigital/lara-content
包简介
Content management package for Laravel with pages, posts, blocks and menus. Blade + Livewire, multilingual support.
README 文档
README
ALPHA VERSION: This package is in early development. The API may change without notice. Not recommended for production use yet.
Content management package for Laravel with pages, posts, blocks and menus. Supports Blade templates with optional Livewire components for interactivity. Includes multilingual support via Spatie Translatable.
Features
- Pages: Flexible page system with customizable layouts and block zones
- Posts: Blog/news posts with author attribution and publishing workflow
- Menus: Hierarchical menu system with nested items
- Blocks: Modular content blocks (HTML, Recent Posts, Menu, Contact Form)
- Layouts: Pre-built page layouts (Single, Sidebar Left/Right, Two/Three Column)
- Multilingual: Full translation support via spatie/laravel-translatable
- Extensible: Register custom layouts and blocks via registries
- Secure: HTML sanitization with configurable allowed tags
Requirements
- PHP 8.3+
- Laravel 12+
- Livewire 3+ (optional, for interactive blocks)
users.idUUID v7 char(36) —lara-contentis UUID-first (see ADR-001). The consumer app'suserstable must use UUID v7 as primary key. Setup guide shared with the AichaDigital umbrella: aichadigital/larabillsetup-uuid.md.
Installation
Install via composer:
composer require aichadigital/lara-content
Publish and run migrations:
php artisan vendor:publish --tag="lara-content-migrations"
php artisan migrate
Publish the config file:
php artisan vendor:publish --tag="lara-content-config"
Optionally publish views for customization:
php artisan vendor:publish --tag="lara-content-views"
Configuration
Key configuration options in config/content.php:
return [ // Author model for posts (must have UUID v7 char(36) primary key) 'author_model' => env('CONTENT_AUTHOR_MODEL', 'App\\Models\\User'), // Cache settings 'cache' => [ 'enabled' => env('CONTENT_CACHE_ENABLED', true), 'default_ttl' => env('CONTENT_CACHE_TTL', 3600), ], // Security: allowed HTML tags and attributes 'security' => [ 'allowed_tags' => ['p', 'br', 'strong', 'em', 'a', 'img', ...], 'allowed_attributes' => [...], ], ];
Usage
Pages
Pages support flexible layouts with multiple content zones:
use AichaDigital\LaraContent\Models\Page; // Create a page $page = Page::create([ 'title' => 'About Us', 'slug' => 'about-us', 'layout' => 'sidebar-right', 'status' => 'published', ]); // Add blocks to zones $page->blocks()->create([ 'zone' => 'main', 'block_type' => 'html', 'content' => ['html' => '<p>Welcome to our company...</p>'], 'order' => 1, ]);
Posts
Blog posts with author attribution:
use AichaDigital\LaraContent\Models\Post; $post = Post::create([ 'title' => 'Getting Started', 'slug' => 'getting-started', 'content' => '# Introduction...', 'author_id' => auth()->id(), 'status' => 'published', 'published_at' => now(), ]);
Menus
Hierarchical menus with nested items:
use AichaDigital\LaraContent\Models\Menu; $menu = Menu::create([ 'name' => 'Main Navigation', 'slug' => 'main-nav', ]); $menu->items()->create([ 'title' => 'Home', 'url' => '/', 'order' => 1, ]);
Blocks
Render blocks in your views:
@foreach($page->blocks as $block) {!! app(BlockRenderer::class)->render($block) !!} @endforeach
Available Layouts
| Slug | Name | Zones |
|---|---|---|
single |
Single Column | main |
sidebar-left |
Sidebar Left | main, sidebar |
sidebar-right |
Sidebar Right | main, sidebar |
two-column |
Two Column | left, right |
three-column |
Three Column | left, center, right |
Available Blocks
| Slug | Name | Interactive | Description |
|---|---|---|---|
html |
HTML Block | No | Raw HTML content |
recent-posts |
Recent Posts | No | List of recent posts |
menu |
Menu Block | No | Render a menu |
contact-form |
Contact Form | Yes | Livewire contact form |
Extending
Custom Layouts
Register custom layouts in your service provider:
use AichaDigital\LaraContent\Registries\LayoutRegistry; use App\Content\Layouts\CustomLayout; public function boot(): void { app(LayoutRegistry::class)->register(new CustomLayout()); }
Custom Blocks
Register custom blocks:
use AichaDigital\LaraContent\Registries\BlockRegistry; use App\Content\Blocks\CustomBlock; public function boot(): void { app(BlockRegistry::class)->register(new CustomBlock()); }
Testing
composer test
Changelog
Please see CHANGELOG for recent changes.
License
AGPL-3.0-or-later. See License File for details.
Lara Content (Español)
VERSION ALPHA: Este paquete está en desarrollo inicial. La API puede cambiar sin previo aviso. No recomendado para producción todavía.
Paquete de gestión de contenido para Laravel con páginas, posts, bloques y menús. Soporta plantillas Blade con componentes Livewire opcionales para interactividad. Incluye soporte multilingüe via Spatie Translatable.
Características
- Páginas: Sistema flexible de páginas con layouts personalizables y zonas de bloques
- Posts: Posts de blog/noticias con atribución de autor y flujo de publicación
- Menús: Sistema jerárquico de menús con elementos anidados
- Bloques: Bloques de contenido modulares (HTML, Posts Recientes, Menú, Formulario de Contacto)
- Layouts: Layouts predefinidos (Una Columna, Sidebar Izquierda/Derecha, Dos/Tres Columnas)
- Multilingüe: Soporte completo de traducciones via spatie/laravel-translatable
- Extensible: Registra layouts y bloques personalizados via registries
- Seguro: Sanitización HTML con tags permitidos configurables
Requisitos
- PHP 8.3+
- Laravel 12+
- Livewire 3+ (opcional, para bloques interactivos)
users.idUUID v7 char(36) —lara-contentes UUID-first (ver ADR-001). La tablausersde la app consumidora debe usar UUID v7 como clave primaria. Guía de setup compartida con el paraguas AichaDigital: aichadigital/larabillsetup-uuid.md.
Instalación
Instalar via composer:
composer require aichadigital/lara-content
Publicar y ejecutar migraciones:
php artisan vendor:publish --tag="lara-content-migrations"
php artisan migrate
Publicar archivo de configuración:
php artisan vendor:publish --tag="lara-content-config"
Opcionalmente publicar vistas para personalización:
php artisan vendor:publish --tag="lara-content-views"
Uso
Páginas
use AichaDigital\LaraContent\Models\Page; // Crear una página $page = Page::create([ 'title' => 'Sobre Nosotros', 'slug' => 'sobre-nosotros', 'layout' => 'sidebar-right', 'status' => 'published', ]); // Añadir bloques a zonas $page->blocks()->create([ 'zone' => 'main', 'block_type' => 'html', 'content' => ['html' => '<p>Bienvenido a nuestra empresa...</p>'], 'order' => 1, ]);
Posts
use AichaDigital\LaraContent\Models\Post; $post = Post::create([ 'title' => 'Primeros Pasos', 'slug' => 'primeros-pasos', 'content' => '# Introducción...', 'author_id' => auth()->id(), 'status' => 'published', 'published_at' => now(), ]);
Menús
use AichaDigital\LaraContent\Models\Menu; $menu = Menu::create([ 'name' => 'Navegación Principal', 'slug' => 'nav-principal', ]); $menu->items()->create([ 'title' => 'Inicio', 'url' => '/', 'order' => 1, ]);
Layouts Disponibles
| Slug | Nombre | Zonas |
|---|---|---|
single |
Una Columna | main |
sidebar-left |
Sidebar Izquierda | main, sidebar |
sidebar-right |
Sidebar Derecha | main, sidebar |
two-column |
Dos Columnas | left, right |
three-column |
Tres Columnas | left, center, right |
Bloques Disponibles
| Slug | Nombre | Interactivo | Descripción |
|---|---|---|---|
html |
Bloque HTML | No | Contenido HTML |
recent-posts |
Posts Recientes | No | Lista de posts recientes |
menu |
Bloque Menú | No | Renderiza un menú |
contact-form |
Formulario Contacto | Sí | Formulario Livewire |
Extensión
Layouts Personalizados
use AichaDigital\LaraContent\Registries\LayoutRegistry; use App\Content\Layouts\MiLayout; public function boot(): void { app(LayoutRegistry::class)->register(new MiLayout()); }
Bloques Personalizados
use AichaDigital\LaraContent\Registries\BlockRegistry; use App\Content\Blocks\MiBloque; public function boot(): void { app(BlockRegistry::class)->register(new MiBloque()); }
Tests
composer test
Licencia
AGPL-3.0-or-later. Ver archivo de licencia para detalles.
aichadigital/lara-content 适用场景与选型建议
aichadigital/lara-content 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「content」 「laravel」 「posts」 「pages」 「blocks」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 aichadigital/lara-content 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aichadigital/lara-content 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 aichadigital/lara-content 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A block that displays featured content - large image, title, description and link.
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
Integrate with Snipcart.
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2026-01-25