2

I would like to install and enable plugins through the command line in a way that can be scripted, and which replicates the same steps as are taken when you install a plugin through the Craft control panel.

What commands are necessary to accomplish this?

Would this be enough?

composer require repo/plugin-name
./craft install/plugin plugin-slug

Will these two commands also install the plugin migrations, enable the plugin, and update the project.yaml file, just as if I had installed the plugin through the control panel?

Is it also necessary to run ./craft migrate/all? Or ./craft clear-caches/all?

Also, is it possible to install a specific plugin edition (e.g. Lite or Pro) through the command line?

Thanks!

1
  • It seems to now be reversed: plugin/install
    – kr37
    Commented May 11, 2023 at 16:25

1 Answer 1

1

Will these two commands also install the plugin migrations

There will be no migrations to run since it is a brand new installation.

enable the plugin, and update the project.yaml file, just as if I had installed the plugin through the control panel?

Yes to both.

Is it also necessary to run ./craft migrate/all? Or ./craft clear-caches/all?

Nope.

Also, is it possible to install a specific plugin edition (e.g. Lite or Pro) through the command line?

Not natively. If a plugin has multiple editions, it will default to whatever is listed in their getEditions() method, which is typically going to be "Lite" first.

1
  • You can potentially use Craft:$app->plugins->setEdition('plugin-handle', 'edition'); in a content migration or modify the edition key in projectConfig to "force" the edition of a plugin, but I don't think it's an official way. Going through the Craft ID/store would be. Commented Feb 3, 2021 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.