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
?
lock file prevents you from automatically getting the latest versions of your dependencies. To update to the latest versions, use the update command. This will fetch the latest matching versions (according to your composer. json file) and update the lock file with the new versions.
update / u# In order to get the latest versions of the dependencies and to update the composer. lock file, you should use the update command. This command is also aliased as upgrade as it does the same as upgrade does if you are thinking of apt-get or similar package managers.
Autoloading: The classmap Directive You just need to provide a list of directories, and Composer will scan all the files in those directories. For each file, Composer will make a list of classes that are contained in that file, and whenever one of those classes is needed, Composer will autoload the corresponding file.
composer install
and/or composer dump-autoload
would do the same. (dump-autoload documentation)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With