Support the ongoing development of Laravel.io →

Laravel Advanced: Lesser-Known, Yet Useful Composer Commands

2 Jun, 2024 2 min read

Photo by Manuel Nägeli on Unsplash

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 3 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

November 18th 2024

Laravel Custom Query Builders Over Scopes

Hello 👋 Alright, let's talk about Query Scopes. They're awesome, they make queries much easier to r...

Read article
November 19th 2024

Access Laravel before and after running Pest tests

How to access the Laravel ecosystem by simulating the beforeAll and afterAll methods in a Pest test....

Read article
November 11th 2024

🍣 Sushi — Your Eloquent model driver for other data sources

In Laravel projects, we usually store data in databases, create tables, and run migrations. But not...

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.