michaelpetri / typed-input
Type safe input wrapper for symfony input
Installs: 246 051
Dependents: 1
Suggesters: 0
Security: 0
Stars: 40
Watchers: 2
Forks: 4
Open Issues: 2
Requires
- php: ~8.2.0 || ~8.3.0
- symfony/console: ^5.2 || ^6.0 || ^7.0
- webmozart/assert: ^1.11
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^10.1.1
- roave/security-advisories: dev-latest
- vimeo/psalm: ^5.1
Conflicts
This package is auto-updated.
Last update: 2024-11-07 04:19:15 UTC
README
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