iTranslated by AI
Laravel 11 install Commands
This article is for Day 12 of the Advent Calendar 2024: Investigating all Artisan commands in Laravel 11.
This time, I investigated the install command.
Environment
- PHP 8.4.1
- laravel/laravel 11.3.3
- laravel/framework 11.33.2
install:api
Creates the API route file and installs Laravel Sanctum or Laravel Passport.
php artisan install:api
Running this command creates the API route file (routes/api.php) by copying the stub file below:
Additionally, it installs Laravel Sanctum (laravel/sanctum).
Finally, it runs the migration for the table used by Laravel Sanctum (personal_access_tokens). (You will be prompted to confirm whether to run it or not.)
| Option | Description |
|---|---|
--composer[=COMPOSER] |
Specify the path to the Composer binary |
--force |
Overwrite the existing API route file |
--passport |
Install Laravel Passport |
--without-migration-prompt |
Do not run migrations |
- You can specify the path to the Composer binary with
--composer(default is global). - Adding
--forcewill overwrite the existing API route file (routes/api.php) with the contents of the stub. - Adding
--passportwill install Laravel Passport (laravel/passport) instead of Laravel Sanctum. - Adding
--without-migration-promptwill end the command without running the migration for the table used by Laravel Sanctum.
install:broadcasting
Enables the broadcasting feature.
php artisan install:broadcasting
Running this command creates the channel route file (routes/channels.php) by copying the stub file below:
A configuration file (config/broadcasting.php) is also created at the same time.
Additionally, it installs Laravel Reverb (laravel/reverb). (You will be prompted to confirm whether to install it or not.)
Finally, it installs Node dependency packages (laravel-echo, pusher-js). (You will be prompted to confirm whether to install them or not.)
| Option | Description |
|---|---|
--composer[=COMPOSER] |
Specify the path to the Composer binary |
--force |
Overwrite the existing channel route file |
--without-reverb |
Do not install Laravel Reverb |
--without-node |
Do not install Node dependency packages |
- You can specify the path to the Composer binary with
--composer(default is global). - Adding
--forcewill overwrite the existing channel route file (routes/channels.php) with the contents of the stub. - Adding
--without-reverbwill skip the installation of Laravel Reverb. - Adding
--without-nodewill skip the installation of Node dependency packages.
Discussion