定制 dgifford/filter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

dgifford/filter

Composer 安装命令:

composer require dgifford/filter

包简介

Class for filtering, validating and sanitizing data.

README 文档

README

This class enables you to easily validate and sanitize data using filter definitions.

The filter definitions can be combined to perform a series of validation/ sanitization operations.

Basic Validation Usage

Use dgifford\Filter\Validator;

// Valid email
$email = new Validator( 'dude@example.com', 'email' );

var_dump( $email->isValid() ); // true

$email->setValue( 'dude@@@@example.com' );

var_dump( $email->isValid() ); // false

Basic Sanitization Usage

Use dgifford\Filter\Sanitizer;

$email = new Sanitizer( ' 	dude@example.com ', 'email' );

echo $email->value;  // ' 	dude@example.com '
echo $email->result; // 'dude@example.com'

var_dump( $email->isValid() ); // true

Editing values and filters

Use dgifford\Filter\Validator;

$email = new Validator( 'dude@example.com', 'email' );

$email->setValue( 'wibble@example.com' );

$email->setFilter( 'email_rfc2822' );

$email->set( 'wibble@example.com', 'email_rfc2822' );

Combining filters

Filters are combined by seperating them with a space.

Use dgifford\Filter\Sanitizer;

$email = new Sanitizer( ' 	dude@example.com ', 'trim email' );

echo $email->result; // 'dude@example.com'

Filter Variables

Some filters can contain variables. This are concatenated to the end of the filter name with the pipe symbol, | .

$email = new Validator( 'dude@example.com', 'email ends_with|@example.com' );

var_dump( $email->isValid() ); // true

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2016-09-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固