Laravel 10.x以降のartisanの「serve」コマンドを解説します。
Description
PHP開発サーバーを起動します。
開発環境でアプリケーションを簡単にテストするために使用できます。
Usage
php artisan serve [--host [HOST]] [--port [PORT]] [--tries [TRIES]] [--no-reload]Options
| オプション | 省略形 | 必須 | 説明 |
|---|---|---|---|
| host | – | – | サーバーのホスト名(デフォルト: 127.0.0.1) |
| port | – | – | サーバーのポート番号(デフォルト: 8000) |
| tries | – | – | ポートが使用中の場合の再試行回数(デフォルト: 10) |
| no-reload | – | – | ファイル変更時の自動リロードを無効にする |
Example
no options
php artisan serve INFO Server running on
![]()
http://127.0.0.1:8000.
Press Ctrl+C to stop the serverhost and port
php artisan serve --host=0.0.0.0 --port=8080 INFO Server running on
![]()
http://0.0.0.0:8080.
Press Ctrl+C to stop the server

