composer Blog Title Image
Share on facebook
Share on twitter
Share on linkedin

composer-logo

 

1. Add the composer.lock and the composer.json to Git.

Composer install will install all the packages you have defined in your composer.lock file.

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 composer update ist your local Environment. But Tipp 2 will help you a little with updating dependencies.

2. Only update what you want

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.

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

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.
composer outdated packages

5. Keep Composer up to date

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

7. Something is not working

one of the first things you can do if something is not behaving as you expect.

The output will give you some valuable information. For example, I should read Tipp 5 again 🙂
composer diagnose

8. Remove a Package

To safely remove a Package use

9. Find new packages on https://packagist.org/

10. Contribute to Composer

There are multiple ways how you can contribute to Composer
– Sponsor a Developer who is working on Composer https://github.com/orgs/composer/people
– Use https://packagist.com/ it’s for hosting private packages
– Work directly on fixing some issues https://github.com/composer/composer/issues

0 0 vote
Article Rating

Subscribe to our newsletter

Be first to read new helpful post

Share this post with your friends

Share on linkedin
Share on xing
Share on twitter
Share on facebook

And the winners are …

As already announced we are going to launch 42workflows in the near future – a free open source package that will help you automate your

symphony process

Symfony Process with Laravel

Are you using ‘exec’, ‘passthru’, ‘shell_exec’ and ‘system’ php functions in your Laravel project? Taking care of security risks by yourself, as well as expecting

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments