How to use composer?
The above describes how to install composer. This chapter will explain how to use composer.
We first simulate downloading a PHP component. First, we search dump on the Packagist website. We can see a list This list displays the query All the dump components are packaged. We see the first symfony/var-dumper. An agreement has been reached between composer and the component. The first information of the component name. Taking the above example, symfony represents the manufacturer name and var-dumper represents Package names. When we install components on the command line, we should use this form:// vendor:厂商名 package:包名 composer require vendor/package
composer require symfony/var-dumper
The vendor directory is our component directory, the result file of composer.json execution command, composer.lock lists all php components, and the specific version number. Now let’s use this dump component and create a new php file in the root directory:
<?php require "vendor/autoload.php"; dump(['1','2','3']); dump(123);
composer tutorial column to learn!
The above is the detailed content of How to use composer. For more information, please follow other related articles on the PHP Chinese website!