Install WordPress Plugins with Composer & WPackagist

Basic example of installing and requiring a WordPress plugin from WPackagist using Composer.
Assumes you already have your WordPress project setup with Composer, and Composer configured to handle WPackagist plugins appropriately. If you are working on a Trellis or Bedrock project, this should be all set.

Example of Installing a Plugin from WPackagist using Composer

For this example we’ll use Disqus plugin and source from from WPackagist

From the directory where the composer.json file is located (typically your main project directory)…
composer require wpackagist-plugin/disqus-comment-system

To specify a version…
composer require wpackagist-plugin/disqus-comment-system ~2.8

To save as required for dev environment…
composer require wpackagist-plugin/disqus-comment-system ~2.8 --save-dev