Laravel 13 introduced a new
artisan dev
command that standardizes everything you need to work on your project: the development server, a queue worker, log output, Vite, and more. Until recently, the skeleton wired those together with a
dev
script in
composer.json
that piped four commands through
npx concurrently
。
Laravel 13.16 replaced it with a first-party command:
php
工匠
开发
这
composer dev
script still exists in the skeleton, but it now does nothing except call
php artisan dev
. The process list moved into PHP, where you can register your own processes with the
DevCommands
班级。
The Defaults
Out of the box the command runs four processes:
| 姓名 | 命令 |
|---|---|
server |
php artisan serve --host=localhost |
queue |
php artisan queue:listen --tries=1 --timeout=0 |
logs |
php artisan pail --timeout=0 |
vite |
npm run dev |
这
桶
process is only registered when the
pcntl_fork
function is available, so Windows users get the other three. The
vite
process picks its prefix from whichever lockfile is in your project—npm, pnpm, Yarn, or Bun—so it runs
pnpm run dev
in a pnpm project without any configuration. Under the hood the command still shells out to
concurrently
, and since 13.18 it passes
--kill-others-on-fail
, so one process crashing stops the rest instead of leaving you with a half-running stack.
Registering Your Own Processes
Defaults cover a fresh install, but few applications stay that way for long. Consider an app that runs Horizon instead of
queue:listen
, broadcasts over
混响
, takes Stripe webhooks locally through the Stripe CLI, and type-checks TypeScript in watch mode. Register all of that in the
boot
你的方法
AppServiceProvider
:
命名空间
应用程序\提供商
;使用
Illuminate\Foundation\DevCommands
;使用
Illuminate\支持\服务提供商
;班级
应用服务提供商
延伸
服务提供者{
民众
功能
引导
()
:
空白{
如果
(
!
$this
->
应用程序
->
环境
(
'当地的'
)){
返回
;}
开发命令
::
工匠
(
'horizon'
,
'队列'
(英文):
开发命令
::
工匠
(
'reverb:start --debug'
,
混响
)
->
purple
();
开发命令
::
登记
(
'stripe listen --forward-to'
。
配置
(
'app.url'
)
。
'/stripe/webhook'
,
'条纹')
->
橙子
();
开发命令
::
nodeExec
(
'tsc --noEmit --watch --preserveWatchOutput'
,
'types'
)
->
黄色的
();}}
Four methods do the registering. The
artisan()
method prefixes the command with
php artisan
,
node()
prefixes it with the detected package manager's run command,
nodeExec()
uses the exec command (
npx
and friends), and
register()
takes a raw shell command for anything else, like the Stripe CLI above.
The second argument is the process name shown in the terminal. Leave it off and the name is the first word of the command, which gives you
horizon
,
reverb:start
, 和
stripe
. That first argument in the example is doing more than labeling, though: registering a process named
queue
replaces the default
queue:listen
worker with Horizon. Names are the identity of a process, so reusing one is how you swap or reconfigure a default:
开发命令
::
工匠
(
'serve --host=localhost --port=9000'
,
'server'
(英文):
Registration order doesn't matter here. Commands registered from your application always outrank the framework defaults, and both outrank anything registered from
vendor
, so an installed package can't quietly take over a process you defined. Packages ship a method you call yourself instead of hooking in during discovery.
Colors are optional. Each process gets a distinct one automatically, and you only reach for
blue()
,
purple()
,
pink()
,
orange()
,
green()
,
yellow()
, 或者
color('#ff6347')
when you want a specific process to stand out.
Checking and Filtering the List
To see what's registered without starting anything, run
php artisan dev:list
, added in 13.17. It prints each process, its command, and the file and line it was registered from—useful when a package's setup instructions added something you've forgotten about.
You can also trim the list without deleting registrations:
// Only run the server and vite processes...开发命令
::
仅有的
(
'server'
,
'迅速地'
(英文):// Run everything except the queue worker...开发命令
::
除了
(
'队列'
(英文):
Both are filters applied at run time, so a process excluded by
except()
still shows up in your provider and can be brought back by deleting one line.
这
dev
command was contributed by
乔·坦南鲍姆
在
Pull Request #60412
, and the full details are in the
Artisan documentation
。







