1. How to install and use composer on
Ubuntu
By: Mohanad Shab Kaleia
2. May 29, 2016
Outline
●
What is composer
●
What is dependencies manager
●
How to install composer
●
How to install a package using composer
●
Update an available package
3. May 29, 2016
What is Composer
●
Composer is a dependencies management
tool for PHP,
●
Used to install packages, libraries, ..etc
needed for the project
●
Free and opensource
●
https://getcomposer.org/
4. May 29, 2016
What is dependencies manager?!
●
Manage your project’s packages and
libraries,
●
Packages Version compatibility between all
team members
●
It take care of download, update needed
packages,
5. May 29, 2016
Install Composer on Ubuntu
●
Step1 – installing the dependencies
– sudo apt-get install curl php5-cli git
●
Step 2 – download and install Composer
– curl -sS https://getcomposer.org/installer | sudo
php -- --install-dir=/usr/local/bin
--filename=composer
●
Step 3 – check if it installed successfully
– $ composer
6. May 29, 2016
Install a package
●
First what is the package you want to install?
●
http://packagist.org
●
For example we will use Slugify package
●
Slug: URL-friendly version
●
Run in the terminal:
– $ composer require cocur/slugify
7. May 29, 2016
Include the package into your project
require __DIR__ . '/vendor/autoload.php';