rareloop/lumberjack-validation 问题修复 & 功能扩展

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

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

rareloop/lumberjack-validation

最新稳定版本:v1.1.3

Composer 安装命令:

composer require rareloop/lumberjack-validation

包简介

README 文档

README

CI Coveralls

This package provides a simple way to validate form input. At it's heart it is a thin wrapper around the Rakit Validation library. For documentation on the types of rules you can use refer to their (Github docs)[https://github.com/rakit/validation.

Once installed, register the Service Provider in config/app.php:

'providers' => [
    ...

    Rareloop\Lumberjack\Validation\ValidationServiceProvider::class,

    ...
],

You can now create Form objects that can be used to validate for your form submissions:

Create a Form Object

class ContactForm extends AbstractForm
{
    protected $rules = [
        'name' => 'required',
        'email' => 'required|email'
    ];
}

Use the form to validate input

Your form can be injected into your Lumberjack Controllers and then used this this:

use App\Forms\ContactForm;

class IndexController
{
    public function handle(ContactForm $form)
    {
        if ($form->validate($_POST)) {
            // Everything's good - do something with the input
        } else {
            $errors = $form->errors();
            $values = $form->values();
            // Re-show the form with the errors and entered values
        }
    }
}

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-02-10