Laravel package to validate input in Artisan console commands.
$ composer require cerbero/command-validator
This package merely consists in the ValidatesInput trait that Artisan commands can use to define their validation rules via the rules() method:
class SampleCommand extends Command
public function rules()
'year' => 'integer|digits:4|min:2000'
Both arguments and options can be validated with the rules provided by Laravel. If you need custom validation, please have a look at how to define custom rules.
Sometimes you may need to show custom messages or attributes for some validation errors, you can achieve that by overriding the methods messages() and attributes():
public function messages()
'min' => 'The minimum allowed :attribute is :min'
public function attributes()
'year' => 'year of birth'
Please see CHANGELOG for more information on what has changed recently.
$ composer test
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
If you discover any security related issues, please email firstname.lastname@example.org instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.