Composer

is free dependency manager for PHP projects that manages packages of application. It manages libraries of your particular project in vendor folder inside your project. It works with packages and libraries and keeps you up to date. It simply finds version of libraries you are using in project and installs Latest version of libraries you need. Composer runs through command line and allow user to install dependencies from packagist.org.

Composer

Package is top repository. Now a days several most popular PHP frameworks are using composer as an internal part to manage dependencies such as laravel and symfony.

Installation in Windows

Download composer setup to install latest version of composer. Now you just need to set path of composer in path environment variable. Then you can use it via composer keyword in command line simply. Composer’s official website let you know how to install composer. Composer installation in Ubuntu is so simple completes in two or three steps.

Installation in Linux

First of al, Update you package manager using below command

Before installing composer you need to install serval dependencies. git is used to download dependencies by composer. curl and php5-cli need to installing and running composer.

Below command will download latest version of composer and install it in dir /usr/local/bin

That’s it, you are ready to use composer. Test your installation by running composer from terminal. Type composer in command line. If you would not get any error then you have successfully install composer.

Installing dependencies via composer

Now quick step to install any dependencies in your project.

and it will download and install package in your project.

Update all dependencies of project

Go to project path throughcd [project path] and run composer update command it will update all the libraries added in composer.json file in require key. require simply tell to composer which dependencies project required.

If you are developing project using PHP framework and not using composer then use it and leave worrying about package management.

  1. Away sum article @Gopal. I am beginner in PHP and have some confusions regarding actually what is composer that’s solved by your article.
    Thanks you

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">