How to install Composer?

If you do the PHP coding project in Linux or Mac, you can’t work without Composer what manage almost module in PHP big project and make things easier. In this article, I will show you the easiest way how to install composer.

composer-install

We only focus to Linux, Mac and Window

Install composer in Linux

To actually get Composer, we need to do two things. The first one is installing Composer (again, this means downloading it into your project):

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

Note: If the above fails for some reason, you can download the installer with php instead:

 

This will just check a few PHP settings and then download composer.phar to your working directory. This file is the Composer binary. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things.

You can install Composer to a specific directory by using the –install-dir option and providing a target directory (it can be an absolute or relative path):

Globally

You can place this file anywhere you wish. If you put it in your PATH, you can access it globally. On unixy systems you can even make it executable and invoke it without php.

You can run these commands to easily access composer from anywhere on your system:

 Install Composer in MAC

You can install Composer via brew like this

And if your MAC don’t have brew ready, you can install brew by this way

 Install composer in Windows

Thing is not easier in Windows but it is not difficult at all, let ‘s follow this command

Or if you think it ‘s too complex then simply download and install this software https://getcomposer.org/Composer-Setup.exe

3 comments

  1. It ‘s easier than I thought, thanks guy for a nice tutorial. You save my time.

  2. It ‘s very easy to get started with composer, thanks for a nice guide

Leave a Reply

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

*