Composer is a well-known tool to manage PHP project dependencies. But I'm pretty sure you're not using all of its features! In this tutorial, we'll show many less-known capabilities of Composer.
1. Versioning Syntax Options
Do you know the difference between the 1.3.*, ^1.3, and ~1.3 versions?
Composer uses quite a complex versioning system with a variety of operators. Let's look at the most common syntax options:
{ "vendor/package": "1.3.2", // exactly 1.3.2 "vendor/package": ">=1.3.2", // anything above or equal to 1.3.2 "vendor/package": "<1.3.2", // anything below 1.3.2 "vendor/package": "1.3.*", // >=1.3.0 <1.4.0 "vendor/package": "1.*", // >=1.0.0 <2.0.0 "vendor/package": "~1.3.2", // >=1.3.2 <1.4.0 "vendor/package": "~1.3", // >=1.3.0 <2.0.0 "vendor/package": "^1.3.2", // >=1.3.2 <2.0.0 "vendor/package": "^0.3.2", // >=0.3.2 <0.4.0 "vendor/package": "^1.1.0", // >=1.1.0 <2.0.0}
There are more combinations supported by Composer, but you will mostly encounter these.
2. Check Outdated Packages
You might want to double-check which packages have newer versions, without actually running composer update. Run this:
composer outdated
And it will give you a list of packages with newer versions:

In this list, you can see all the direct packages that have newer versions available. Some of them will automatically update with the composer update command, but some of them might require manual version change.
3. Bumping Versions
Last year Composer introduced a new command composer bump. Its main job is...
Premium Members Only
This advanced tutorial is available exclusively to Laravel Daily Premium members.
Already a member? Login here
Premium membership includes:
Great...!!!
Thank you! Really helpful!
Thanks. Composer has always something to learn. I did not know about the "--optimize-autoloader" flag. Great read!
That was great! Learned something new today, cool!
composer status
Shows a list of locally modified packages. Checks for local modifications of files (when you edit something locally but did not yet push and configure it to your own branch). Run this command before a composer update to prevent losing your changes.
In the composer section. "vendor/package": "^0.3.2", would be can be any version greater than or equal to 0.3.2 but less than 1.0.0.
This section in the article is correct 😉. Versions before 1.0 have a bit different range of rules. Please, check it out in the composer docs and the summary.
nice and clean :)