1. Download Official Installer in project folder
Execute following command in terminal:
$ cd path/to/project $ curl -sS https://getcomposer.org/installer | php
2. Download the PHP library required
$ php composer.phar require <library>
3. Include library in PHP code
After adding following above the code, we can start using the library.
include_once(__DIR__.'/vendor/autoload.php'); use <library>;
4. Add composer generated files to .gitignore
This is done so that these files are untracked and will not be pushed to remote origin branch (e.g. Github).
5. Command to install all dependencies in composer.json
$ php composer.phar install
Hopefully you are able to successfully use Composer in your PHP project now. 😃
Please let me know how it goes in the comments below. Thank you for reading! 😊
- MailGun Documentation