Skip to main content

Number

Integer input: digits with an optional leading minus, accepted as an int.

$p->number('port', 'HTTP port')->default(8080);

Declare optional min, max and step to bound the value and enable keyboard adjustment. Up and Down then adjust the value by the step (defaulting to 1), clamped to the range, and an entry outside the range is rejected inline with a clear message. The bounds are enforced headlessly too - a --prompts or environment value outside the range is rejected - and are reflected in the JSON schema as min, max and step on the prompt. With none declared the field stays a plain integer entry with the arrow keys inert.

$p->number('port', 'HTTP port')->min(1)->max(65535)->step(1)->default(8080);
ANSINo ANSI
UnicodeNumber: Unicode + ANSINumber: Unicode + No ANSI
ASCIINumber: ASCII + ANSINumber: ASCII + No ANSI