Php fusion
Publié le - 1625 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 Fév. 2022Bitcoin Mining with Machines: The Best Strategies for Increased Profits102 v.
  2. 27 Janv. 2022Honest and Explicit: SitePoint's Definitive List of the Best PHP Development Sites159 v.
  3. 25 Déc. 202112 Reasons Why You Should Became a PHP Programmer in Canada126 v.
  4. 19 Déc. 2021The Benefits of Hiring a PHP Development Company129 v.
  5. 22 Nov. 2021When You Want to Move a PHP Website: Tips for Successful Relocation195 v.
  6. 11 Août 2021The Importance of a PHP Developer: Understand Your Needs238 v.
  7. 3 Juil. 2021Look at the new publishing media !275 v.
  8. 23 Avril 2021Is ruby for you?336 v.
  9. 13 Fév. 2021Suggest a good php service is also improved the SEO of a website355 v.
  10. 21 Déc. 2020Working with the most competent Php firms413 v.
  11. 10 Déc. 2020Building a bridge inbetween SEO and Php programming478 v.
  12. 3 Déc. 2020What php means527 v.
  13. 4 Nov. 2020All the services provided by a Php company452 v.