定制 movisio/condition-parser 二次开发

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

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

movisio/condition-parser

Composer 安装命令:

composer require movisio/condition-parser

包简介

Movisio Condition parser

README 文档

README

A simple condition parsing and evaluation library. Shunting-yard algorithm for parsing strings to expression trees that can ben evaluated later. Supports variables that can be set for each evaluation.

Installation:

composer require movisio/condition-parser

Example usage:

$expression = ConditionParser::parse('$deleted == 0 && $id > 1');
$conditionObject = new ArrayObject($userEntityData);
$can_be_deleted = $expression->evaluate($conditionObject)

Once parsed $expression object can be evaluated multiple times with different data. The parse() method requires an object implementing the \ArrayAccess interface currently because we use it mostly with ORM entities that can implement it and because at the moment it is not possible to type-hint to array and \ArrayAccess at the same time.

v1.0.2

  • tests for invalid inputs
  • remove forbidden throw from __toString()
  • add parsing of null

v1.0.1

  • more unit tests
  • fixes
    • better handling of int and float constants including toString() not quoting numbers
    • fix exception on empty($x) and toString() on UnaryOperator

v1.0.0 - initial release

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-06-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固