#19 alay
是的,有几种批量安装 Flarum 插件的方案:
使用 composer.json 批量添加:
{
"require": {
"flarum/core": "^1.8.0",
"flarum/flags": "^1.8.0",
"flarum/likes": "^1.8.0",
"flarum/tags": "^1.8.0",
"fof/formatting": "^1.0.3",
"fof/pages": "^1.0.8",
"fof/oauth": "^1.6.8",
// ... 其他插件
}
}
然后运行:
composer update
使用脚本批量安装:
#!/bin/bash
plugins=(
"flarum/flags:^1.8.0"
"flarum/likes:^1.8.0"
"fof/formatting:^1.0.3"
# ... 添加更多插件
)
for plugin in "${plugins[@]}"
do
echo "Installing $plugin"
composer require "$plugin" --no-interaction
done
# 清理缓存和更新数据库
php flarum cache:clear
php flarum migrate
使用 composer require 一次性安装多个:
composer require \
flarum/flags:^1.8.0 \
flarum/likes:^1.8.0 \
fof/formatting:^1.0.3 \
fof/pages:^1.0.8
建立一个基础安装模板:
{
"name": "your-forum/template",
"description": "Forum template with common extensions",
"type": "project",
"require": {
"flarum/core": "^1.8.0",
// 基础插件
"flarum/flags": "^1.8.0",
"flarum/likes": "^1.8.0",
"flarum/tags": "^1.8.0",
// FoF 插件
"fof/formatting": "^1.0.3",
"fof/pages": "^1.0.8",
// 其他常用插件
"v17development-seo": "^1.8.0"
},
"config": {
"sort-packages": true
},
"scripts": {
"post-install-cmd": [
"php flarum migrate",
"php flarum cache:clear"
]
}
}
注意事项:
- 安装前建议备份数据库
- 确保插件版本兼容
- 建议分批安装,每批10-15个插件
- 每批安装后测试是否有冲突
- 记录已安装的插件列表
建议使用 composer.json 的方式,因为:
- 可以版本控制
- 便于管理依赖
- 可以复用到其他项目
- 方便回滚
如果您想尝试,我可以帮您整理一个常用插件的批量安装清单。