定制 kivagant/amatch 二次开发

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

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

kivagant/amatch

Composer 安装命令:

composer require kivagant/amatch

包简介

Validation and matching for associative arrays

README 文档

README

Validate associative arrays

Habrahabr examlpes:

See examples in folder 'examples'.

This is short demo for usage:

<?

$params_bad = array(
    'doc_id' => -4,
    'subject_id' => null,
    'parent_id' => 30,
    'data' => array(
        'flag' => 'booom',
        'from_topic' => array(),
        'old_property' => true,
    ),
    'wtf_param' => 'exploit',
);
$match = AMatch::runMatch($params_bad)
    ->doc_id(0, '<') // Left value is smaller then array value
    ->subject_id(0, '!=') // Array value != zero
    ->subject_id('', '!float') // Array value is not float
    ->author_name(AMatch::OPTIONAL, 'string') // String type or not defined
    ->author_name('Guest') // Array value equal 'Guest'
    ->parent_id(AMatch::OPTIONAL, 'int') // Int type or not defined
    ->parent_id(0, '<') // Left value is smaller than array value
    ->parent_id(array(32, 33), 'in_left_array') // Array value exists in this array
    ->data('', 'array') // Type of array value is 'array'
    ->data('', '!empty') // Array value not empty
    ->data('old_property', '!key_exists') // Array does not have this key
    ->data('experiment', 'in_array') // In array value must be another array with value 'experiment'
    ->title() // This key must exist
    ;
if ($match->stopMatch()) {
	echo 'Victory!';
} else {
	var_export($match->matchComments());
}

?>

统计信息

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

GitHub 信息

  • Stars: 16
  • Watchers: 9
  • Forks: 3
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固