Php fusion
Publié le - 1265 v. -

All you need to know about composer

Composer is a free package manager written in PHP. That is, a tool that automates the procedures for installing, uninstalling, and updating software within a computer system. Composer allows its users to declare and install the libraries for which the main project needs
The project is now available on the GitHub platform, web hosting and software development management service, using the Git VCS.

Using Composer

The installation of Composer is very simple, you must have the php command available in the terminal.
Composer uses a composer.json file that contains several information about the project, including a list of the libraries used. It is then able to automatically download these libraries (and associated dependencies) and generate an autoloader to use them simply in your PHP projects. This file will list all the files to download and will have to be at the root of your project. The file composer.json allows you to specify the different dependencies.

In the require section you will be able to put the packages you want to use for your project.
The list of all packages is available on Once the list of dependencies specified you just have to install them with a: "composer.phar install".
This will create (or update) the vendor file that will contain your library. The advantage is that Composer is able to handle dependencies, so if your library needs another library to run it will be automatically downloaded.

And in my PHP

So it's nice to download libraries, but still have to be able to include them. During an install or update Composer will automatically generate an autoloader autoload.php available at the root of the vendor folder.
This autoloader does not have to include the files of the different libraries, but uses a system of autoloader.

To know more about Composer, connect with our php developers. Composer is adopted by the majority of the PHP community (CakePHP, Laravel, Symfony ... all use it) and will allow you to manage simply the dependencies of your projects.


Les publications similaires de "Actu PHP"

  1. 4 Août 2020Just the Php company you need41 v.
  2. 12 Mai 2020What is the difference inbetween a Php developer and a Magneto developer ?103 v.
  3. 3 Avril 2020The latest about php!150 v.
  4. 4 Mars 2020How can you insert a basket for an ecommerce ?152 v.
  5. 4 Fév. 2020Why it is important to have a development website ?164 v.
  6. 5 Déc. 2019Worldwide Php website development with Simplyphp215 v.
  7. 4 Fév. 2018How to hire a php developer?917 v.
  8. 27 Juin 2017One of the most widely used server-side scripting languages1258 v.
  9. 6 Oct. 2016Php and website1139 v.
  10. 25 Sept. 2016How to change the design of a website without breaking the code ?1097 v.
  11. 25 Juil. 2016PHP and ecommerce1209 v.
  12. 28 Juin 2016Migrating from an old Php to a new one1287 v.
  13. 30 Avril 2016Develop and improve your website with Php12824 v.