The problem
You started your first Laravel project with php artisan serve. What you might not have realised: that was your first encounter with the tool you'll use more than any other as a Laravel developer. Artisan is Laravel's command-line tool. It generates files, runs your migrations and lets you inspect your app, all without leaving the terminal.
What you'll learn
- What Artisan is and how an Artisan command is structured
- How to discover which commands exist and what they do
- The
make:commands that generate files for you - How to run migrations and check their status
- How to look inside your app with
about,route:listandtinker
Prerequisites
- A Laravel project running locally (see Installing Laravel)
- You know where
.envand the config files live (see .env and config files in Laravel) - You can open a terminal in your project folder
What is Artisan?
In the root of every Laravel project there's a file simply called artisan. It's a PHP script, and you run every command by having PHP execute it:
php artisan <command> <arguments> --<options>
Think of Artisan as an assistant that handles the boring work. Instead of creating a controller file yourself, finding the right folder and typing out the boilerplate, you ask Artisan to do it. The result always lands in the right place, with the right structure.
Commands are grouped with a colon: everything about migrations starts with migrate, everything that generates something starts with make:, everything about routes starts with route:.
Step by step
Step 1 — Discover what's there
You don't need to memorise commands. Artisan tells you what it can do:
php artisan list
You'll see a long list, grouped by topic. Want to know what one specific command does and which options it takes? Add --help:
php artisan make:controller --help
This is the most important command in this whole post. It lets you explore every other command on your own.
Step 2 — Generate files with make:
The make: commands create new files in the right place. A controller:
php artisan make:controller CourseController
This creates app/Http/Controllers/CourseController.php, with the correct namespace and an empty class, ready to fill.
A model with its migration in one go:
php artisan make:model Course -m
The -m option tells Laravel to create a migration in database/migrations/ alongside app/Models/Course.php, with a name like 2026_10_01_120000_create_courses_table.php. One command instead of two.
Other make: commands you'll run into soon:
php artisan make:migration add_price_to_courses_table
php artisan make:seeder CourseSeeder
php artisan make:request StoreCourseRequest
Step 3 — Update your database with migrate
A migration describes a change to your database, such as creating a table. This command runs every migration that hasn't run yet:
php artisan migrate
Want to see which migrations have run and which haven't?
php artisan migrate:status
Just ran a migration and spotted a mistake in your columns? Roll back the last batch, fix the migration and run it again:
php artisan migrate:rollback
php artisan migrate
Step 4 — Look inside your app
Artisan doesn't just generate things, it also shows you what's going on in your app. An overview of your environment, Laravel version, database and cache settings:
php artisan about
Every route in your app, with its URL, HTTP method and the controller that handles it:
php artisan route:list
Right now you won't see much here. In the next post, on routing, this becomes one of your best friends.
Step 5 — Try things quickly with tinker
tinker opens an interactive PHP shell with your whole Laravel app loaded. Perfect for a quick check:
php artisan tinker
Then you type plain PHP:
config('app.name');
now()->addDays(7)->format('d-m-Y');
Type exit to leave.
Common mistakes
1. Running Artisan outside your project folder
Seeing this message?
Could not open input file: artisan
You're in the wrong folder. The artisan file lives in your project root, so that's where your terminal needs to be. Move into your project first:
cd path/to/your-project
php artisan list
2. Using migrate:fresh without knowing what it does
You'll often find advice online to run php artisan migrate:fresh when something's wrong with your database. It works, but this command drops all your tables, including all data, and rebuilds them. Locally with test data, that's fine. Never run it on a database whose data you want to keep. When in doubt, use migrate:rollback and migrate:status, which are far less destructive.
3. You changed something, but your app still uses the old version
Laravel caches some things, like config, routes and views, to run faster. If you've ever run a cache command, your app can keep using stale data. One command clears all of those caches at once:
php artisan optimize:clear
Stuck and can't figure out why your change isn't showing up? This is always a good first step.
Recap
- Artisan is Laravel's command-line tool, and you start every command with
php artisan. php artisan listand--helpshow you what's available, so there's nothing to memorise.make:commands generate files in the right place, andmake:model Course -mcreates a migration too.migrate,migrate:statusandmigrate:rollbackmanage your database, but be careful withmigrate:fresh.about,route:listandtinkerlet you look inside your app, andoptimize:clearsolves many "why isn't anything changing" moments.
Where to go next
In the next post we dive into routing in Laravel. That's where route:list becomes genuinely useful, as you see how every URL in your app reaches the right code.
Want to go beyond this handful of commands? The Laravel 13 training includes the full command reference and the workflow habits that save you time every day, and you practise them straight away in a real project.