I need to discus a very important thing for me (probably for all users who uses composer in their projects). I am working on laravel. Whenever i work on my local machine, i run composer update after adding new library in vendor.
Now it works fine on local machine. But when i upload these files on my server, it shoots error like "Undefine class ....". I dont know how to run composer update command on server (Also it might be not safe).
So may i just know which files are updated by using composer update
on cmd. What other files needed to go live to avoid this error??
update / u / upgrade# 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.
The “composer update” command have the following options: --prefer-source: With this command, packages will be installed from source if available. --prefer-dist: With this command, packages will be installed from dist if available. --dry-run: This simulates an update, without actually updating the dependencies.
You may:
composer update
on your local server only, whenever you want.composer.lock
) but the vendor
directory
vendor
, with composer.lock
)composer install
on your production server. It will update all your dependencies according to your composer.lock
(so the exact same versions as your last update on your local server).So in other words: you should not run composer update
on your server, just composer install
on every delivery (and you will need to keep your composer.lock
)
Hope it will help you.
run composer dump-autoload
before composer update
. If still doesn't work then try to clear composer cache using composer clear-cache
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