Php fusion
Publié le - 335 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 packagist.org. 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.

Exprimez-vous.

Les publications similaires de "Actu PHP"

  1. 27 Juin 2017One of the most widely used server-side scripting languages200 v.
  2. 6 Oct. 2016Php and website422 v.
  3. 25 Sept. 2016How to change the design of a website without breaking the code ?420 v.
  4. 25 Juil. 2016PHP and ecommerce538 v.
  5. 28 Juin 2016Migrating from an old Php to a new one573 v.
  6. 30 Avril 2016Develop and improve your website with Php1954 v.
  7. 17 Mars 2016Php useful links, heeerree !686 v.
  8. 5 Mars 2016The code can help you to rank on Google !769 v.
  9. 1 Fév. 2016PhP 7, accepted and adopted by all developers847 v.