M7: 全量测试(25 用例)+ README + 部署文档(nginx/systemd/cron)+ theme:publish 命令
This commit is contained in:
@@ -1,59 +1,119 @@
|
||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||
# LaraLog
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
基于 **Laravel 12 + Filament 5 + Livewire 4 + Spatie 生态** 的现代化博客系统,从 SaBlog-X 1.6 完整迁移而来:
|
||||
|
||||
## About Laravel
|
||||
- **脚本迁移**:`php artisan sablog:import` 一键从老库迁入全部数据(文章/分类/评论/标签/友链/用户/附件),保留原始 ID,老 URL 全部 301 兼容
|
||||
- **多主题**:`themes/` 目录即皮肤,后台一键切换/上传 ZIP;内置 sablog 经典风 + modern 简约风两套
|
||||
- **插件系统**:`plugins/` 目录 + 钩子系统(action/filter),ZIP 安装 + 可选远程市场
|
||||
- **内置插件**:SEO & GEO(JSON-LD/OG/llms.txt/Markdown 导出)、AI 评论审核 + 内容润色(Workerman 异步)、支付(支付宝/微信/沙箱)、会员(套餐订阅 + 付费文章)
|
||||
- **附件全走 S3**:R2 / COS / OSS 兼容,新上传零落盘,`attachments:sync-s3` 一键同步老附件(大文件 Multipart)
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
## 技术栈
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
| 组件 | 版本 | 说明 |
|
||||
|------|------|------|
|
||||
| Laravel | ^12.0 | 应用框架 |
|
||||
| Filament | ^5.7 | 后台面板(zh_CN) |
|
||||
| Livewire | ^4.4 | 前台交互 |
|
||||
| Workerman | ^5.2 | 常驻进程:队列消费者 + WebSocket 进度推送 |
|
||||
| yansongda/pay | ^3.7 | 支付宝 / 微信支付 |
|
||||
| spatie 库 | — | permission / medialibrary / sitemap / robots / tags / backup |
|
||||
| league/commonmark | ^2.9 | Markdown 渲染(GFM) |
|
||||
| league/html-to-markdown | ^5.1 | 老 HTML 内容转换 |
|
||||
| MySQL | 8.x | 数据库 |
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
## 快速开始
|
||||
|
||||
## Learning Laravel
|
||||
```bash
|
||||
# 1. 安装依赖
|
||||
composer install
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. You can also check out [Laravel Learn](https://laravel.com/learn), where you will be guided through building a modern Laravel application.
|
||||
# 2. 配置 .env(MySQL 8)
|
||||
DB_DATABASE=laralog
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
# 3. 迁移 + 种子(创建 admin@laralog.test / password)
|
||||
php artisan migrate --seed
|
||||
|
||||
## Laravel Sponsors
|
||||
# 4. 启动(Herd 或 artisan serve)
|
||||
php artisan serve
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
|
||||
# 5. 后台:http://laralog.test/admin
|
||||
```
|
||||
|
||||
### Premium Partners
|
||||
## 迁移老 Sablog
|
||||
|
||||
- **[Vehikl](https://vehikl.com)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
|
||||
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
|
||||
- **[Redberry](https://redberry.international/laravel-development)**
|
||||
- **[Active Logic](https://activelogic.com)**
|
||||
```bash
|
||||
# 原始导入(内容保持 HTML,[attach=xx] 渲染时解析)
|
||||
php artisan sablog:import \
|
||||
--database=sablog --host=127.0.0.1 --port=3306 \
|
||||
--username=root --password=xxx \
|
||||
--attachments-dir=/path/to/old/attachments --sync-attachments
|
||||
|
||||
## Contributing
|
||||
# 同时把内容转换为 Markdown([attach=xx] 转为 {{attach:xx}} 令牌)
|
||||
php artisan sablog:import ... --convert-markdown
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
# 事后单独转换 / 同步附件到 S3
|
||||
php artisan content:convert --all
|
||||
S3_ACCESS_KEY=... S3_BUCKET=... S3_ENDPOINT=... php artisan attachments:sync-s3 --legacy-dir=/path/to/old/attachments
|
||||
```
|
||||
|
||||
## Code of Conduct
|
||||
> 不迁移的过时功能:trackback(引用通告,垃圾来源)、搜索缓存表、验证码(由 AI 审核 + 蜜罐 + 频控取代)、WAP、广告位变量。
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
## 主题
|
||||
|
||||
## Security Vulnerabilities
|
||||
- 目录:`themes/{name}/`,含 `theme.json`(标题/版本/描述/作者)+ `views/**` + `assets/`
|
||||
- 激活主题的 views 目录前置到全局视图路径:主题覆盖同名视图,缺失自动回退默认视图
|
||||
- 资产开发期由 `/themes/{name}/assets/...` 流式返回;生产可 `php artisan theme:publish`(见 docs/deploy.md)
|
||||
- 后台「主题管理」可激活 / 上传 ZIP / 删除
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
## 插件
|
||||
|
||||
## License
|
||||
- 目录:`plugins/{vendor}.{name}/`,含 `plugin.json` + `src/ServiceProvider.php`(继承 `App\Blog\Support\PluginServiceProvider`)+ 可选 `database/migrations`、`routes/web.php`、`views/`
|
||||
- 钩子:`addAction(hook, cb)` / `addFilter(hook, cb, priority)`,核心钩子:
|
||||
- `comment.created`(AI 审核)、`payment.paid`(订阅激活/解锁)、`post.rendered`(付费内容过滤)、`seo.structured_data`
|
||||
- 后台「插件管理」:启停 / 上传 ZIP 安装 / 卸载 / 市场拉取(配置 `MARKET_URL` 后可用)
|
||||
- 插件自带迁移由 `migrate` 自动加载(`app/Providers/AppServiceProvider` 注册 plugins/*/database/migrations)
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
## 内容格式
|
||||
|
||||
- 每篇文章有 `content_format`(markdown / html),新文章默认 Markdown
|
||||
- 老数据导入标记为 html 原样保留;`content:convert` 批量转 Markdown
|
||||
- 附件短代码:HTML 内容用 `[attach=1]` / `[img=1]`,Markdown 内容用 `{{attach:1}}` / `{{img:1}}`(`[]` 是 Markdown 保留字符),渲染时统一解析
|
||||
- 付费内容:`[paid]...[/paid]` 短代码,非会员/未解锁访客隐藏(会员插件)
|
||||
|
||||
## 异步处理(Workerman)
|
||||
|
||||
```bash
|
||||
php artisan workerman:serve start # 队列消费者 × N + WebSocket :8787
|
||||
php artisan workerman:serve stop
|
||||
```
|
||||
|
||||
- 队列消费者在常驻进程内复用 Laravel 容器,省去每次任务的框架启动开销(LLM 调用主路径)
|
||||
- 任务统一实现 `App\Blog\Jobs\AiJob` 接口(`handle(LlmClient)`),Workerman 反序列化执行
|
||||
- 降级路径:`php artisan queue:work` 照常可用(同一队列)
|
||||
|
||||
## 测试
|
||||
|
||||
```bash
|
||||
php artisan test # 25 个用例:迁移/老路由 301/主题/插件/会员支付流/AI 审核
|
||||
```
|
||||
|
||||
## 目录结构
|
||||
|
||||
```
|
||||
app/
|
||||
Blog/ # 前台域模块(Controllers/Jobs/Services/Support/View)
|
||||
Filament/ # 后台资源与页面
|
||||
Console/Commands # sablog:import / attachments:sync-s3 / workerman:serve / content:convert
|
||||
themes/ # 主题(sablog / modern)
|
||||
plugins/ # 内置插件(blog-seo / ai-moderation / payment / membership)
|
||||
docs/deploy.md # 部署指南
|
||||
```
|
||||
|
||||
## 许可
|
||||
|
||||
MIT
|
||||
|
||||
Reference in New Issue
Block a user