What is it?

Composer is an application-level package manager for PHP. In simple words, Composer manages packages per-project basis, installing them in a directory (e.g. vendor) inside your project.

How to use it?

Composer and Composer2 (meant for PHP 8.0 versions) are already pre-installed on all Shared (except for Shared Single and Single WordPress) and Cloud plans. You can confirm that by logging in to your hosting account via SSH and using this command: composer. More information about that can be found here:

Using Composer can be done like this:

  • Paste this code to the terminal, you can see how composer.json, composer.lock files and Vendor directory will be created:

Now you can go ahead and test the package out, simply create/edit your existing PHP file. Comprehensive examples can always be found on the Packagist website.

That’s it! Now you know how to use Composer 😊

NOTES:

Did this answer your question?