承接 askedio/laravel-validator-filter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

askedio/laravel-validator-filter

Composer 安装命令:

composer require askedio/laravel-validator-filter

包简介

Filter items before validating them with Laravels Validator

README 文档

README

Filter items before your validate them with Laravel 5s Validator.

Values will be filtered based on the function you provide. If the parameter exists in the request it will also be replaced.

Build Status Codacy Badge Codacy Badge StyleCI

Installation

composer require askedio/laravel-validator-filter

Add the following to the providers array in config/app.php:

Askedio\LaravelValidatorFilter\FilterServiceProvider::class

Examples

You can use any function that is callable and accepts the value as the parameter.

$validator = app('validator')->make([
  'string' => 'Hello ' . PHP_EOL . ' World',
], [
  'string' => 'filter:strip_tags,nl2br',
]);

$validator->passes();

dd($validator->getData());

You can use a function with parameters in line. () = [] & , = ;.

$validator = app('validator')->make([
  'string' => 'Hello <br> World<p></p>',
], [
  'string' => 'filter:strip_tags[{$value}; "<br>"]',
]);

$validator->passes();

dd($validator->getData());

You can also define your own custom filter.

app('filter')->register('plusOne', function ($value) {
    return $value+1;
});

$validator = app('validator')->make([
  'int' => '<br>1',
], [
  'int' => 'filter:strip_tags,plusOne',
]);

$validator->passes();

dd($validator->getData());

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固