Skip to content

Type safe input wrapper for symfony input

License

Notifications You must be signed in to change notification settings

michaelpetri/typed-input

Repository files navigation

Typed Input

Type Coverage Latest Stable Version License

Installation

composer require michaelpetri/typed-input 

Usage

$typedInput = TypedInput::fromInput($input);

echo $typedInput->getOption('my-option')->asNonEmptyString();
echo $typedInput->getArgument('my-argument')->asInteger();

Available methods

  • asBoolean
  • asBooleanOrNull
  • asInteger
  • asIntegerOrNull
  • asPositiveInteger
  • asPositiveIntegerOrNull
  • asNaturalInteger
  • asNaturalIntegerOrNull
  • asString
  • asStringOrNull
  • asNonEmptyString
  • asNonEmptyStringOrNull
  • asNonEmptyStrings
  • asDateTimeImmutable