The installed composer is easy to use, with two-step loading of components
Cases
1. Search component: Composer Search Phpexcel
2. Download component: Composer require manufacturer name/package name
Then, in the script that uses the plug-in, reference
Require ' vendor/autoload.php ';
Then the instantiation can be done;
-----------
Command:
Composer//list how this command is used
-------------------------------Composer Installation---------------------
Running Composer requires PHP 5.3.2+ or later
Linux Installation composer
1. Global Installation composer
Curl-ss Https://getcomposer.org/installer | Php
MV Composer.phar/usr/local/bin/composer
2. Create a Composer.json file
Vim Composer.json
Write the content such as:
{
"Require": {
"Monolog/monolog": "1.0.*"
}
}
3. Execute the dependencies defined in the load Composer.json file
Composer Install
4. Update dependencies
Composer Update
Used when a new dependency is defined in the Composer.json file
Or
Use when updating an existing dependency
5. If you only want to install or update a dependent
Composer Update Monolog/monolog//This is just an example of monolog, other dependencies Remember to modify the name
6. For the library's automatic loading information, Composer generates a vendor/autoload.php file.
You can simply introduce this file and you will get a free auto-load support.
Require ' vendor/autoload.php ';
--------------------------------Vendor/Package name----------------------------------------
Composer name of the vendor and package name
The name of each PHP component consists of a vendor name and a package name.
Vendor Name/package name together to form a complete component name
The vendor name is globally unique and is used to identify who owns the package.
The package name is used to uniquely identify a package in the name of the specified manufacturer.
--------------------------------Component Version number----------------------------------
Modern PHP components use a semantic version scheme (http://semver.org/) version number consisting of three dots.
such as (1.3.1)
First Number: The major version number, which increases the major version number if the update of the PHP component destroys backward compatibility.
Second number: Minor version number, if the PHP component minor update does not break backward compatibility, the minor version number will be promoted.
Third Number: Revision number, if the PHP component fixes a backward-compatible defect, the revision number is promoted.
--------------------------------Composer Download the latest components-------------------------
Warning: Never blindly execute code downloaded from a remote URL. We need to look at the remote code first to figure out what he's doing.
Also, be sure to download remote code over HTTPS.
-------------------
Executing commands in the top-level directory of an application project
Such as
Composer require vendor/package
Composer require League/flysystem
This command lets composer find and install the latest stable version of the specified PHP component
This command also allows composer to update the component to the latest version prior to the next major version.
The above command allows composer to download the two components to the vendor/directory in the top-level directory of the project, and also
Create the Composer.json file and the Composer.lock file.
The use of Linux composer