Support the ongoing development of Laravel.io →

Laravel Advanced: Lesser-Known, Yet Useful Composer Commands

2 Jun, 2024 2 min read

Composer is the go-to dependency manager for PHP, and if you're working with Laravel, you're already familiar with frequently used commands like composer install and composer update. Composer also offers some commands that are lesser-known but helpful while working on your Laravel app.

image

Here are five Composer commands you might not know but would love to use.

1. composer outdated

Ever wondered which of your app dependencies are outdated? composer outdated gives you a quick rundown of all packages that have newer versions available. This is especially useful for keeping your project up-to-date and secure.

composer outdated

This lists all the outdated packages in your project, showing the current and latest versions. It's a handy way to stay on top of updates without blindly running composer update.

2. composer show

Need an overview of the installed packages? The composer show displays information about all the packages installed in your project.

composer show

You can also use it to get details about a specific package by passing the package name:

composer show vendor/package
# Example: composer show backpack/crud

It’s a great way to quickly check the installed version, description, and dependencies of any package in your project.

3. composer why

Wanna figure out why a particular package is installed? composer why helps you trace the dependency tree to understand which package requires it.

composer why vendor/package

4. composer licenses

Wanna know the licenses of the packages you are using? composer licenses provides a summary of all the licenses of the installed dependencies. This is useful for ensuring compliance with open-source licenses.

composer licenses

5. composer check-platform-reqs

Checking all required PHP extensions are installed can be a hassle while working on a project across multiple environments. The composer check-platform-reqs command checks if your platform meets the package requirements.

composer check-platform-reqs

This command verifies that the PHP version and all required extensions are installed and meet the version constraints specified in your composer.json.

Conclusion

While basic Composer commands get the job done, these lesser-known commands can save you time and hassle by giving you deeper insights and more control over your project's dependencies. So, the next time you fire up your terminal, try these commands and see how they can improve your Laravel experience.

All of the above have been previously shared on our Twitter, one by one. Follow us on Twitter; You'll ❤️ it. You can also check the first article of the series, which is on the Top 5 Scheduler Functions you might not know about. Keep exploring, and keep coding with ease using Laravel. Until next time, happy composing! 🚀

Last updated 2 weeks ago.

driesvints, sardorjs liked this article

2
Like this article? Let the author know and give them a clap!

Other articles you might like

June 17th 2024

Laravel Advanced: Top 5 Scheduler Functions You Might Not Know About

In this article series, we go a little deeper into parts of Laravel we all use, to uncover functions...

Read article
June 9th 2024

Top 10 Laravel Collection Methods You May Have Never Used

In this article series, we go a little deeper into parts of Laravel we all use, to uncover functions...

Read article
June 5th 2024

Laravel Reverb and Vue 3 + TypeScript : Add Realtime to your App

In many modern web applications, WebSockets are used to implement realtime, live-updating user inter...

Read article

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.