class DevCommands

Properties

static protected NodePackageManager|null $packageManager

The resolved NodePackageManager instance.

static protected int $colorCount

Counter to keep track of how many colors have been assigned.

static protected DevCommand> $commands

The registered development commands.

static protected list<string> $only

The names of commands that should be included when running the "dev" command.

static protected list<string> $except

The names of commands that should be excluded when running the "dev" command.

Methods

static void
registerDefaults()

Register the default development commands.

static DevCommand
register(string $command, string|null $name = null)

Register a development command.

static DevCommand
artisan(string $command, string|null $name = null)

Register an Artisan command, automatically prefixing it with "php artisan".

static DevCommand
node(string $command, string|null $name = null)

Register a Node command, automatically prefixing it with the detected package manager's run command.

static DevCommand
nodeExec(string $command, string|null $name = null)

Register a Node command, automatically prefixing it with the detected package manager's exec command.

static array
commands()

Get the registered development commands.

static array
fillInEmptyColors(array $commands)

Fill in any empty colors in the given commands array, ensuring each command has a color assigned.

static string
getColor(array $commands)

Get a color for a command, ensuring that colors are reused only after all available colors have been used at least once.

static array
resolveSource(array $trace)

Resolve the first external caller frame from a debug backtrace.

static int
resolvePriority(array $trace)

Determine the registration priority from a debug backtrace.

static bool
isDependencyFile(string $file)

Determine whether a file belongs to an installed Composer dependency.

static bool
isWithinPath(string $path, string $directory)

Determine whether a path is the given directory or one of its descendants.

static void
only(string ...$names)

Set the commands that should be included when running the "dev" command.

static void
except(string ...$names)

Set the commands that should be excluded when running the "dev" command.

getPackageManager()

Resolve and return the NodePackageManager instance.

static void
flushState()

Flush all static state.

Details

at line 52
static void registerDefaults()

Register the default development commands.

Boot-only. The commands persist in static properties for the worker lifetime and affect every subsequent development command invocation.

Return Value

void

at line 71
static DevCommand register(string $command, string|null $name = null)

Register a development command.

Boot-only. The command persists in a static property for the worker lifetime and affects every subsequent development command invocation.

Parameters

string $command
string|null $name

Return Value

DevCommand

at line 98
static DevCommand artisan(string $command, string|null $name = null)

Register an Artisan command, automatically prefixing it with "php artisan".

Boot-only. The command persists in a static property for the worker lifetime and affects every subsequent development command invocation.

Parameters

string $command
string|null $name

Return Value

DevCommand

at line 109
static DevCommand node(string $command, string|null $name = null)

Register a Node command, automatically prefixing it with the detected package manager's run command.

Boot-only. The command persists in a static property for the worker lifetime and affects every subsequent development command invocation.

Parameters

string $command
string|null $name

Return Value

DevCommand

at line 120
static DevCommand nodeExec(string $command, string|null $name = null)

Register a Node command, automatically prefixing it with the detected package manager's exec command.

Boot-only. The command persists in a static property for the worker lifetime and affects every subsequent development command invocation.

Parameters

string $command
string|null $name

Return Value

DevCommand

at line 130
static array commands()

Get the registered development commands.

Return Value

array

at line 153
static protected array fillInEmptyColors(array $commands)

Fill in any empty colors in the given commands array, ensuring each command has a color assigned.

Parameters

array $commands

Return Value

array

at line 169
static protected string getColor(array $commands)

Get a color for a command, ensuring that colors are reused only after all available colors have been used at least once.

Parameters

array $commands

Return Value

string

at line 185
static protected array resolveSource(array $trace)

Resolve the first external caller frame from a debug backtrace.

Parameters

array $trace

Return Value

array

at line 208
static protected int resolvePriority(array $trace)

Determine the registration priority from a debug backtrace.

Parameters

array $trace

Return Value

int

at line 249
static protected bool isDependencyFile(string $file)

Determine whether a file belongs to an installed Composer dependency.

Parameters

string $file

Return Value

bool

at line 275
static protected bool isWithinPath(string $path, string $directory)

Determine whether a path is the given directory or one of its descendants.

Parameters

string $path
string $directory

Return Value

bool

at line 286
static void only(string ...$names)

Set the commands that should be included when running the "dev" command.

Boot-only. The filter persists in a static property for the worker lifetime and affects every subsequent development command invocation.

Parameters

string ...$names

Return Value

void

at line 297
static void except(string ...$names)

Set the commands that should be excluded when running the "dev" command.

Boot-only. The filter persists in a static property for the worker lifetime and affects every subsequent development command invocation.

Parameters

string ...$names

Return Value

void

at line 305
static protected NodePackageManager getPackageManager()

Resolve and return the NodePackageManager instance.

Return Value

NodePackageManager

at line 313
static void flushState()

Flush all static state.

Return Value

void