ostark / craft-plugin-commands
从命令行管理Craft插件
    2.0.0
    2022-10-04 17:59 UTC
Requires
- craftcms/cms: ^3.2.0 || ^4.0.0
This package is auto-updated.
Last update: 2024-09-04 22:22:47 UTC
README
这是一个有意不是插件,而是一个Yii扩展。不需要引导或启用它,它会自动注册。
安装
要求包
composer require ostark/craft-plugin-commands
用法
获取所有插件列表
./craft plugin/list
5 plugins found
╔═══════════════════════════╤════════════╤═══════════════╤═══════════════╗
║ Handle                    │ Version    │ Developer     │ Status        ║
╟───────────────────────────┼────────────┼───────────────┼───────────────╢
║ aws-s3                    │ 1.0.8      │ Pixel & Tonic │ Disabled      ║
╟───────────────────────────┼────────────┼───────────────┼───────────────╢
║ async-queue               │ 1.3.0      │ Oliver Stark  │ Enabled       ║
╟───────────────────────────┼────────────┼───────────────┼───────────────╢
║ fortrabbit-object-storage │ 0.1.0      │ Oliver Stark  │ Not installed ║
╟───────────────────────────┼────────────┼───────────────┼───────────────╢
║ happy-brad                │ v1.2       │ Matt Stauffer │ Enabled       ║
╟───────────────────────────┼────────────┼───────────────┼───────────────╢
║ upper                     │ 1.3.1      │ Oliver Stark  │ Not installed ║
╚═══════════════════════════╧════════════╧═══════════════╧═══════════════╝
安装并启用所有或单个插件
php craft plugin/install ALL
php craft plugin/install {plugin-handle}
卸载所有或单个插件
php craft plugin/uninstall ALL
php craft plugin/uninstall {plugin-handle}
禁用所有或单个插件
php craft plugin/disable ALL
php craft plugin/disable {plugin-handle}
启用所有或单个插件
php craft plugin/enable ALL
php craft plugin/enable {plugin-handle}
使用 --env-only 标志限制执行到特定环境。此选项仅在自动化部署过程中有用,例如在共享的 composer.json 中定义的 post-install-cmd。
{
    "scripts": {
        "post-install-cmd": [
            "php craft plugin/disable {plugin-handle} --env-only=production",
            "php craft plugin/enable {plugin-handle} --env-only=dev,staging"
        ]
    }
}