michaelpetri/typed-input

Type safe input wrapper for symfony input

1.3.2 2023-12-04 07:08 UTC

README

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