webook/laravel-cms
Composer 安装命令:
composer require webook/laravel-cms
包简介
A lightweight, file-based inline CMS for Laravel that allows direct editing of content on the page
README 文档
README
A Webflow-like inline content management system for Laravel applications.
Installation
1. Install via Composer
composer require webook/laravel-cms
2. Publish Configuration
php artisan vendor:publish --provider="Webook\LaravelCMS\CMSServiceProvider" --tag=cms-config
3. Publish and Run Migrations
php artisan vendor:publish --provider="Webook\LaravelCMS\CMSServiceProvider" --tag=cms-migrations
php artisan migrate
4. Create Storage Link
For image uploads to work properly, you need to create a symbolic link:
php artisan storage:link
5. Publish Assets (Optional)
If you want to customize the CMS assets:
php artisan vendor:publish --provider="Webook\LaravelCMS\CMSServiceProvider" --tag=cms-assets
Configuration
The configuration file will be published to config/cms.php. You can customize:
- Toolbar settings: Position (top/bottom), theme (dark/light), auto-injection
- Storage settings: Disk and path for media uploads
- Cache settings: Enable/disable caching, TTL
- Editor settings: Toolbar buttons available in the rich text editor
- Media settings: Upload disk, path, max file size, allowed file types
Usage
Basic Usage
Once installed, the CMS toolbar will automatically be injected into your pages when enabled.
- Navigate to any page in your application
- Click "Edit" in the toolbar to enter edit mode
- Hover over any content to see editable areas
- Click to edit text inline
- For images, hover to see the gear icon for changing images
- Click "Save" to persist changes
Permissions
By default, the CMS is available without authentication. To restrict access, add your own middleware to the configuration:
// config/cms.php 'middleware' => [ 'web', 'auth', // Add authentication 'can:edit-content', // Add authorization ],
Excluding Content
To prevent content from being editable, add the data-cms-ignore attribute:
<div data-cms-ignore="true"> This content won't be editable </div>
Database Content
Content fetched from database models will automatically be marked as "coming soon" and won't be editable yet.
Features
- ✅ Inline content editing
- ✅ Rich text editor with formatting options
- ✅ Image upload with drag-and-drop
- ✅ Link editing
- ✅ Automatic backup system
- ✅ Dark mode toolbar
- ✅ Mobile responsive
- ✅ Pages explorer
- ✅ Multi-language ready (coming soon)
- ✅ Media library (coming soon)
Troubleshooting
Images return 403 Forbidden
Make sure you've created the storage link:
php artisan storage:link
Content changes don't persist
Clear the view cache after updates:
php artisan view:clear php artisan config:clear
Toolbar doesn't appear
-
Check that CMS is enabled in your
.env:CMS_ENABLED=true -
Clear caches:
php artisan cache:clear php artisan config:clear
Requirements
- PHP 8.1 or higher
- Laravel 10.x or 11.x
License
MIT License
Support
For issues and questions, please use the GitHub issue tracker.
统计信息
- 总下载量: 43
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-29