Search

An Introduction to Laravel's Artisan Console

November 30, 2016 —John Koster

The Artisan Command Line Environment (CLI) is a terminal based application that can be used to ease development with Laravel. Artisan ships with many commands by default as well as exposes APIs to create your own custom commands.

Many of the commands available are commands to either generate database tables, manage existing tables or clear various application caches. The commands are organized by command namespaces; for example, the clear command under the view namespace would clear the previously cached views and is written as view:clear.

#Database Management Commands

This section will provide a reference for the commands that are used to create and manage database tables. Each command will be discussed in greater detail in later sections.

Command Signature Description
migrate --database --force --path --pretend --seed --step Runs the database migrations.
migrate:install --database Creates the migrations table.
migrate:refresh --database --force --path --seed --seeder Resets and run all migrations again.
migrate:reset --database --force --pretend Rollback all database migrations.
migrate:rollback --database --force --pretend Rollback the last database migration.
migrate:status --database --path Show the status of each migration.
cache:table Creates a migration for the cache table.
queue:table Creates a migration for the queue jobs table.
session:table Creates a migration for the sessions table.

#Cache Management Commands

This section will provide a reference for the commands that are used to generate or clear various caches used by your application. Each command will be discussed in greater detail in later sections.

Command Description
cache:clear Flushes the application cache.
config:cache Creates a cache file to improve configuration performance.
config:clear Removes the configuration cache file.
route:cache Create a cache file to improve router performance.
route:clear Remove the route cache file.
view:clear Clear all compiled view files.

#Default Artisan Commands

The following sections will discuss each of the default Artisan commands.

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.