siriusphp/filtration 问题修复 & 功能扩展

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

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

siriusphp/filtration

Composer 安装命令:

composer require siriusphp/filtration

包简介

Data filtration library

README 文档

README

#Sirius\Filtration

Source Code Latest Version Software License Build Status Coverage Status Quality Score

PHP library for array filtering/sanitization

Sometimes you want to make sure the values pushed by a source (eg: a user when submits a form) follow some restrictions like

  • no space at the beginning or the end for the title of a page
  • no HTML code in a comment sent by a user
  • no spaces in the field which represents the URL
  • remove XSS attacks
  • etc...

Other times you want to make sure that the data you send to the user is parsed before displaying. For example you may want to:

  • convert markdown into HTML
  • convert URLs into links
  • apply a localized format to dates
  • etc ()

To achieve this end result you need to filter the values. This is where SiriusFiltration comes into place

Elevator pitch

use Sirius\Filtration\Filtrator;

$filtrator = new Filtrator();

// add filters for title
$filtrator->add('title', 'trim');
$filtrator->add('title', 'strip_tags');
$filtrator->add('title', 'nullify');

// add filters for content in one go
$filtrator->add('content', [
	'trim'
]);

$result = $filtrator->filter(array(
	'title' => '   <h1>My title has tags and is awesome</h1>',
	'content' => '   My content was trimmed'
));

/* $result is
array(
	'title' => NULL ,
	'content' => 'My content was trimmed'
)
*/

Links

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-01-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固