How to install and use composer on ubuntu ?

We all know there are various PHP frameworks/libraries available in the market but there was a need to manage them through one source and that is “Composer”. In this article, we will see What is composer and How to install and use composer on ubuntu.

lets cut to the chase, Composer is a package manager which manages different framework/libraries aka packages of PHP. you can also read composer documentation on their official website https://getcomposer.org/ lets start with installation.

Before installing the composer make sure you have installed PHP on your system.

Download Composer

To download composer enter the following command in terminal.

curl -sS https://getcomposer.org/installer | php

Now move the .phar file to bin/composer and make it accessible to all users

sudo mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer

Now composer is accessible by any user. To verify this enter the following command

composer

You will se result something like this

How to install composer on ubuntu

Now then Composer is installed on your local system. There are various options use with composers. if you want to see them type the following command

composer -h 

or

composer -help

How to use composer ?

Create a directory by following command

mkdir myFolderName

move to created directory

cd myFolderName

use composer to install the package you want.

composer install packageName

That’s all about How to install and use composer on ubuntu. now you are good to go and use it for package management.

Hope this article has helped you, in case of any errors that occurred during this installation, leave comments.

Similar articles :

Leave a Reply

Your email address will not be published. Required fields are marked *