5 Artisan Tricks That Will Make Your Laravel Dev Life Easier
5 Artisan Tricks That Will Make Your Laravel Dev Life Easier
You've been using Artisan since your first php artisan make:controller. We all have. But between the
commands you run daily and the ones you've never discovered, there's a surprisingly wide gap. Today we're
closing it a little.
Here are five Artisan tricks that range from "wait, this exists?" to "why didn't I know this sooner."
1. php artisan about - Your App's Cheat Sheet
Introduced in Laravel 9, php artisan about gives you a quick, readable snapshot of your application's
environment. It shows your Laravel version, PHP version, environment, debug mode status, cache driver,
queue driver, and more -- all in one clean table.
php artisan about
It even accepts a --only flag to narrow down the output:
php artisan about --only=environment
This is especially useful when you're jumping between projects or helping a colleague debug their setup without logging into the server. Skip the "what version is that running?" Slack thread entirely.
2. php artisan model:show - X-Ray Vision for Your Eloquent Models
model:show was added in Laravel 9.22 and it is genuinely one of the most useful debug commands in the
toolkit. Run it against any Eloquent model and you'll get a full breakdown of:
- All attributes and their cast types
- Relationship definitions (including the related model class)
- Observers attached to the model
- Scopes defined on the model
php artisan model:show User
Before this command existed, getting that kind of overview required either reading the source or spelunking through the database schema directly. Now it takes two seconds. Your future self thanks you.
3. Filter php artisan route:list Like a Pro
You already use php artisan route:list. But do you filter it? On a large application, that unfiltered
list can be a wall of text that tells you nothing useful. Here are the flags you should be using:
# Show only routes whose URI starts with "api"
php artisan route:list --path=api
# Filter by route name
php artisan route:list --name=user
# Exclude routes registered by vendor packages
php artisan route:list --except-vendor
# Show only routes for a specific HTTP method
php artisan route:list --method=POST
You can combine --path with --except-vendor to cut the noise dramatically in package-heavy applications.
4. php artisan db - An Instant Database Shell
This one surprises a lot of developers. Since Laravel 8, you can drop straight into an interactive database shell from Artisan:
php artisan db
It opens a native client for your configured database -- MySQL, PostgreSQL, SQLite -- using your app's
.env credentials. No copy-pasting connection strings. No fumbling with mysql -u root -p.
You can also specify a connection by name:
php artisan db mysql
php artisan db pgsql
Great for quick queries during development without spinning up a full GUI client.
5. php artisan schedule:list - Know What's About to Run
If your app has a scheduler, you know that mysterious feeling of wondering exactly what's queued up and
when. schedule:list shows all registered scheduled tasks along with their next scheduled run time.
php artisan schedule:list
The output includes the command, cron expression, optional description, and the next due datetime. No more reading the Kernel to figure out when that database cleanup job runs at 2am on a Tuesday.
Bonus: php artisan inspire
This one won't make you a better developer. But when you're deep in a debugging session that's gone sideways, a random philosophical quote might be exactly what you need.
php artisan inspire
"First, solve the problem. Then, write the code." -- John Johnson
Artisan's got your back, even philosophically.
Wrapping Up
Artisan has a lot more hiding under the surface than most developers ever discover. Make a habit of running
php artisan list on projects you haven't touched in a while -- package authors often add useful commands
that go completely unnoticed.
For the full reference, check out the official Laravel Artisan docs.
Sources: