Description of new features in composer 2.0

藏色散人
Release: 2020-12-22 16:17:24
forward
2868 people have browsed it

Below, composer uses the tutorial column to introduce the new features of composer 2.0. I hope it will be helpful to friends in need!

Description of new features in composer 2.0

#1. What are the new features?

  • For command line (CLI) users

  • New platform check feature checks runtime PHP version and available extensions to ensure They match project dependencies. If a mismatch is found, it will exit with error details. It is recommended to use the production PHP process during build or deployment to run composer check-platform-reqs

  • If the package exists in a higher priority repository, it is now in a lower priority The package will be completely ignored in the repository. For more information, see Repository Priority.

  • Invalid PSR-0/PSR-4 class configurations are no longer autoloaded in optimized autoloader mode, per the warning introduced in 1.10

  • On linux systems that support the XDG base directory specification, Composer now prefers to use XDG_CONFIG_DIR/composer instead of ~/.composer (if both are available 1.x uses ~/.composer first)

  • Package names must now comply with our naming guidelines, otherwise Composer will error and terminate. (https://github.com/composer/composer/blob/2.0.0/doc/04-schema.md#name)

  • --no-suggest is deprecated, Since it is no longer needed

  • PEAR support (repositories, downloaders, etc.) has been removed

  • update now lists the composer first. lock file (update step) and then lists the changes that were applied when installing the lock file into the vendor directory (installation step)

  • HTTPS_PROXY_REQUEST_FULLURI will now default to false if not specified, As this seems to work better in most environments

  • dev-trunk, dev-master and dev-default are no longer aliases for each other. Keep the exact branch name for now.

2. Detailed differences in event flow during dependency resolution, composer update and installation

composer v1

  • composer resolves dependencies (Scheduling PRE/POST_DEPENDENCIES_SOLVING)

  • Then, it goes through all packages step by step (Scheduling PRE_PACKAGE_INSTALL/UPDATE/UNINSTALL , then schedule PRE_FILE_DOWNLOAD as needed, then POST_PACKAGE_*).

  • Finally write the lock file at the end

composer v2

  • The update and installation processes have been split.

Update meeting:

  • composer resolves dependencies (scheduling PRE_POOL_CREATE)

  • Then write the lock file, update is completed

Then install:

  • Send to PRE_OPERATIONS_EXEC to execute Full list of operations

  • Download all packages not already in cache in parallel (scheduling PRE_FILE_DOWNLOAD for packages not yet in cache)

  • Then , which iterates through all packages and performs updates/installs/uninstalls in parallel (PRE_PACKAGE_INSTALL/UPDATE/UNINSTALL is distributed first, then POST_PACKAGE_*, but the last package launched may finish installing before another one is completed).

The above is the detailed content of Description of new features in composer 2.0. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:oschina.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template