michaelpetri / typed-input
Type safe input wrapper for symfony input
Installs: 248 008
Dependents: 1
Suggesters: 0
Security: 0
Stars: 40
Watchers: 2
Forks: 4
Open Issues: 0
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-18 08:33:41 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