Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How composer can only update and load automatically

Shulou Source: shulou.com Published: 2022-06-01 17:19:40 10月27日 Update

This article mainly explains "composer how to do only update automatic load", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "composer how to do only update automatic load" bar!

Specific problem description:

Composer only updates the autoload, not the dependency?

Psr-4 automatic loading has been added to composer.json

Then execute composer update to load the added directory

Dependency packages are always updated when update is executed

How can I just update the autoload and not update the dependency?

Solution:

Composer dump-autoload

Print auto-load index dump-autoload

In some cases you need to update autoloader, such as adding a new class to your package. You can use dump-autoload to do this without having to execute install or update commands.

In addition, it can print an index of classes that are optimized and conform to the PSR-0/4 specification, which is also for performance considerations. In large applications, there will be many kinds of files, and autoloader will take up a large part of the time of each request, so it may not be convenient to use classmaps in development, but it can still get the convenience brought by PSR-0/4 specification while ensuring performance.

Print automatically load Index-Parameter

-- optimize (- o): convert PSR-0/4 autoloading to classmap for faster loading. This is especially suitable for production environments, but it may take some time to run, so it is not currently the default setting.

-- no-dev: disable the autoload-dev rule.

Thank you for your reading, the above is "composer how to do only update automatic loading" of the content, after the study of this article, I believe you have a deeper understanding of how to do composer only update automatically load this problem, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Update index learning content performance situation time problem big premise method parameter command that is ideas files articles time more faster Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno macOS Apple MySQL NVidia