LinuxCommandLibrary

php-artisan

Manage and develop Laravel applications

TLDR

Start PHP's built-in web server for the current Laravel application

$ php artisan serve
copy

Start an interactive PHP command-line interface
$ php artisan tinker
copy

Generate a new Eloquent model class with a migration, factory and resource controller
$ php artisan make:model [ModelName] --all
copy

Display a list of all available commands
$ php artisan help
copy

SYNOPSIS

php artisan [options] [arguments]

: Refers to a specific Artisan task to execute, such as migrate, make:model, serve, or optimize.
[options]: Optional flags that modify the behavior of the command, often prefixed with -- (e.g., --force, --seed) or - for short versions.
[arguments]: Optional values or parameters passed to the command (e.g., the name of a model for make:model).

PARAMETERS

--version, -V
    Displays the current Laravel framework version.

--help, -h
    Displays help information for the current command or lists all available commands if no specific command is provided.

--quiet, -q
    Suppresses all command output, useful for scripting or automated tasks.

--verbose, -v, -vv, -vvv
    Increases the verbosity of messages: -v for normal output, -vv for more verbose, and -vvv for debug output.

--no-interaction, -n
    Prevents the command from asking any interactive questions, assuming default answers or failing if input is required.

--env[=ENV]
    Specifies the application environment to run the command in (e.g., --env=production).

DESCRIPTION


php artisan is the command-line interface (CLI) included with the Laravel PHP web framework. It provides a robust set of helpful commands that assist developers in building and managing Laravel applications. Artisan automates many repetitive and common development tasks, significantly enhancing productivity.

Common uses include running database migrations (e.g., php artisan migrate), generating boilerplate code like controllers, models, and migrations (e.g., php artisan make:controller), clearing various caches, managing queues, and serving the application locally (php artisan serve).

Beyond its built-in functionalities, Artisan is highly extensible, allowing developers to create custom commands tailored to their specific project needs. It is an indispensable tool in the Laravel ecosystem, streamlining the development workflow by providing a unified and consistent way to interact with the application from the terminal.

CAVEATS


php artisan is not a standalone Linux command; it requires a PHP interpreter installed on the system and must be executed from the root directory of a Laravel project. Its functionality is entirely dependent on the Laravel framework and any installed packages within that project.

The specific commands and options available can vary significantly between different Laravel versions and custom project configurations.

<I>CUSTOM COMMANDS</I>

Developers can extend Artisan's capabilities by creating their own custom commands. This allows for automation of project-specific tasks, integration with external services, or any recurring process unique to the application, making Artisan highly adaptable.

<I>INTERACTIVE PROMPTS</I>

Many Artisan commands leverage interactive prompts, guiding the user through complex operations by asking for necessary input step-by-step. This feature simplifies command usage and reduces the need to memorize all possible options or arguments.

HISTORY


Artisan was introduced early in the development of the Laravel framework, which was created by Taylor Otwell in 2011. Inspired by similar command-line tools in other frameworks (like Ruby on Rails' Rake), Artisan quickly became a cornerstone of Laravel development. It evolved significantly with each major Laravel release, expanding its feature set and becoming increasingly integral to managing all aspects of a Laravel application, from initial setup to deployment and maintenance.

SEE ALSO

php(1), composer(1), npm(1), mysql(1)

Copied to clipboard