devlop/laravel-console-input-validation 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

devlop/laravel-console-input-validation

Composer 安装命令:

composer require devlop/laravel-console-input-validation

包简介

Trait to simplify the validation of console input in Laravel commands

README 文档

README

Latest Stable Version License

Laravel Console Input Validation

A small trait to make it easier to validate the input to your Laravel commands.

Installation

composer require devlop/laravel-console-input-validation

Usage

use Devlop\Laravel\Console\ValidateInput;
use Symfony\Component\Console\Input\InputInterface;

class DemoCommand extends Command
{
    use ValidateInput;

    /**
     * Validate the console command input.
     *
     * @throws InvalidArgumentException
     */
    protected function validate(InputInterface $input) : void
    {
        // Example using manual validation
        if (! is_numeric($input->getOption('limit'))) {
            throw new InvalidArgumentException('--limit must be numeric');
        }

        // Example using webmozarts/assert
        Assert::numeric($input->getOption('limit')); // assert that the --limit option got a numeric value
        Assert::greaterThan($input->getOption('limit'), 0); // assert that the --limit option get a value greater than 0
    }

    public function handle() : int
    {
        // ...
    }
}

统计信息

  • 总下载量: 101
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固