Laravel Artisan Command Input Syntax Reference

December 1, 2016 —John Koster

The following table serves as a quick reference for the common command signature definitions. The Syntax column demonstrates the syntax required, the Description column provides a description or quick explanation of the syntax and the Required column indicates if the end user will be required to provide a value for the resulting parameter or option when executing the resulting command.

Syntax Description Required
{test} A required parameter test with no default value. Yes
{test} : Description} Adding a description to a parameter. Yes
Specifying a default value for a parameter. No
{test?} Making a parameter optional. No
{test*} Accept an array of input and store it in the value test. Yes
{test?*} Accept an optional array of input, and store it in the value test. No
--test Define a boolean flag named --test. No
--test | Description Adding a description to an option. No
--T|test Define a boolean flag named --test with a shortcut named -T. No
--test=Default Define an option named --test with the default value Default. No
--test=* Accept an optional array of input, and store in the value --test. No

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.