LinuxCommandLibrary

laravel

Manage and create Laravel projects

TLDR

Create a new Laravel application

$ laravel new [name]
copy

Use the latest development release
$ laravel new [name] --dev
copy

Overwrite if the directory already exists
$ laravel new [name] --force
copy

Install the Laravel Jetstream scaffolding
$ laravel new [name] --jet
copy

Install the Laravel Jetstream scaffolding with a specific stack
$ laravel new [name] --jet --stack [livewire|inertia]
copy

Install the Laravel Jetstream scaffolding with support for teams
$ laravel new [name] --jet --teams
copy

List the available installer commands
$ laravel list
copy

SYNOPSIS

php artisan [command] [options]

PARAMETERS

list
    Displays a list of all available Artisan commands.

help [command]
    Displays help information for a specific command.

make:controller [name]
    Creates a new controller class.

make:model [name]
    Creates a new Eloquent model class.

migrate
    Runs pending database migrations.

migrate:fresh
    Drop all tables and re-run all migrations.

db:seed
    Seeds the database with records.

cache:clear
    Flushes the application cache.

queue:work
    Start processing jobs on the queue as a daemon.

--env[=ENV]
    The environment the command should run under.

--no-interaction
    Do not ask any interactive question.

DESCRIPTION

The laravel command is not a standard Linux command but rather an executable that typically resides within a Laravel PHP framework project. It invokes Laravel's Artisan console, a powerful command-line interface (CLI) included with Laravel. Artisan provides a wide array of helpful commands for scaffolding, database migrations, code generation, cache management, and many other tasks related to Laravel application development. It drastically simplifies repetitive tasks and provides a consistent way to interact with and manage Laravel projects.

The availability and specific commands within Artisan depend entirely on the Laravel version and the project's custom configurations. It is usually executed from the root directory of a Laravel project.

CAVEATS

The laravel command itself doesn't exist as a standalone Linux command. It's an executable provided by the Laravel framework within a project. Therefore, it only works within a Laravel project directory where Artisan is available. Requires PHP and Composer to be installed.

USAGE EXAMPLE

Navigate to a Laravel project directory in your terminal. Then run `./artisan migrate` or `php artisan migrate` to run pending database migrations.

CUSTOM COMMANDS

Artisan can be extended with custom commands tailored to specific project needs. These commands can automate complex tasks unique to the application.

HISTORY

Artisan was introduced with the Laravel framework to streamline common development tasks. It evolved significantly with each Laravel version, adding more commands and features to improve developer productivity. It's a central part of the Laravel ecosystem and widely used by Laravel developers.

Copied to clipboard