1. Add the composer.lock and the composer.json to Git.
composer install
Composer install will install all the packages you have defined in your composer.lock file.
composer update
Composer update will fetch the newest possible version defined in your composer.json. That means the versions of the packages can change based on your rules. If you put in a * for the version it could install a new version with breaking changes. The only good place to run a composer update ist your local Environment. But Tipp 2 will help you a little with updating dependencies.
2. Only update what you want
composer update 42coders/document-templates
This would only update the 42coders/document-templates Package and its dependencies. It will not touch any other Package.
3. Use composer command line to get new packages
This one is clear for most people I think.
composer require 42coders/document-templates
This will actually do the following things β Add the Package in the latest version to the composer.json β Run a composer update 42coders/document-templates to add it to the composer.lock
4. Finding outdated packages
composer outdated -D
This will search for all packages you are using and list the ones which have new versions available. The -D parameter will only list the packages defined in your composer.json. Like this as an example.
5. Keep Composer up to date
composer self-update
Will check the currently installed version of Composer and update it if a newer one is available.
6. Rewrite your autoloading files
Sometimes it happens that you get an error some class is not available. But in your code, you see the class β¦ There is a chance the class isnβt just added to your autoloading files
composer dump-autoload
7. Something is not working
one of the first things you can do if something is not behaving as you expect.
composer diagnose
The output will give you some valuable information. For example, I should read Tipp 5 again π