You are currently viewing Composer Package Manager

Composer Package Manager

These days I finally got to start getting into Laraver 4 – a framework recently being praised among the PHP community. I got a bit confused when reading the instructions to its installation. Up to now installing a PHP framework or library used to involve downloading and extracting a single zip or tarball archive. The case was different with the installation of Laravel – it required the mastering and usage of a tool called Composer.

The closest association that I can come up with to describe to you what Composer is and does, is with the most popular GNU/Linux package managers. Probably most of you have installed different software via the apt package manager on Ubuntu Linux and yum on Fedora.

Composer is a package manager written entirely in PHP for the download and installation of a variety of libraries and frameworks for PHP development. Other popular languages for web programing already have similar utilities – Ruby on Rails, Node.JS and Python communities have gem, npm and pip accordingly to install and handle different package dependencies.

When speaking of Composer we should mention This is its official repository with all the packages listed and described. You can browse here through all the software that can be downloaded with the package manager to use in your PHP project. The creators and maintainers of the repository include only stable versions of the software included.

Currently there is no graphical interface for Composer. It is a command line tool. There’s an installer for Windows, which you can download from the Composer website at After installing it you can proceed on the MS Command Prompt. The Composer commands and options are the same on Windows and Linux operating systems which makes it more attainable for different types of users.

Let us proceed with a few instructions on installing Composer on a Unix-like system (MacOS, Linux) and a guide to your first few steps into using the utility.

This command will download the composer.phar:

$ curl -sS | php

The phar extension stands for a PHP archive. You can now move the composer.phar to a directory from your shell path so that you can use it each time without typing the full path to the composer binary.

$ mv composer.phar /usr/bin/composer

Now you can get started with Composer!

For example let us install Laravel framework with the create-project command:

$ composer create-project laravel/laravel –prefer-dist

This will download and install the framework with all its dependencies in the current directory. After that a hidden folder .composer will be created in your home directory containing different configuration files.

The philosophy of Laravel framework, which its creators strive to maintain, is combining different proved to be successful paradigms and libraries among the PHP community and in web development as a whole. It is influenced by Symphony, Ruby on Rails, ASP.NET MVC and so forth.

After you have downloaded Laravel or any other framework with Composer you may notice the vendor directory. It contains all the dependencies needed for its functioning, specifically external libraries. You can imagine the effort needed for installing manually all those packages by downloading and extracting them one by one.

You may also notice a composer.json. This is a configuration file created after a package is installed. It lists all its dependencies. Composer reads and writes from it when it has to download and/or uprage them.

You can try and see for yourself if the usage of Composer is unecessary or if it will revolutionize the way PHP applications are created. Some of you may say that learning new syntax may take some additional effort. Personally it didn’t take long for me to learn its commands. What is more getting acquainted with such a tool would definitely make it faster for me to install and upgrade PHP packages.
Overall Composer leans towards the automation of the installation of different packages , which makes setting up a new dev environment so much easier!

You can use Composer to install different packages on our VPS servers and our Shared hosting services via SSH. Our services are optimized for hosting Laravel-based applications and other widely-used frameworks. Our Tech Support Team will help you with the setup.

Cvetomir Denchev

Always willing to learn new concepts and skills not only in the area of Internet and computers. During his free time you can find him reading books on various topics and styles, at a concert, watching a flick from one of his favorite directors or travelling to different places (sometimes even hitchhiking).

Leave a Reply