Home » Php » php – Updating Composer autoload files without `composer update`?

php – Updating Composer autoload files without `composer update`?

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’m working on a project which has a lot of dependencies which I personally control. Whenever the namespace mapping changes in a requirement, I need to run composer update to refresh the Composer autoload file so the namespace mappings can be picked up.

However if I’m making changes in the vendor/ directory directly, there’s no need to check out the latest versions through composer update — all I need is to refresh the autoload file. For a project with dozens of requirements hosted on GitHub, composer update can take minutes.

Is there any way to get composer to refresh the autoload files without having to run composer update?

How to&Answers:

composer install and/or composer dump-autoload would do the same.
(dump-autoload documentation)

Answer:

There are some interesting tips here that allow directly editing the source files in the vendor directory and composer to work together.

http://moquet.net/blog/5-features-about-composer-php/