kphoen/rulerz-bundle
Composer 安装命令:
composer require kphoen/rulerz-bundle
包简介
Symfony2 Bundle for RulerZ
README 文档
README
This bundle integrates RulerZ into Symfony.
Installation
Require the bundle:
composer require 'kphoen/rulerz-bundle'
And declare it into your app/AppKernel.php file:
public function registerBundles() { return array( // ... new KPhoen\RulerZBundle\KPhoenRulerZBundle(), ); }
Usage
This bundle registers a rulerz service which is an instance of RulerZ\RulerZ.
$rulerz = $this->container->get('rulerz'); $rulerz->filter(/* ... */);
See RulerZ's documentation for more information.
Custom operators
Custom operators can be added to RulerZ executors. The bundle provide a way to register new operators directly from the container, you just need to tag a service:
services: operator.array.like: class: RulerZ\Operator\ArrayExecutor\Like tags: - { name: rulerz.operator, target: native, operator: like }
In addition to the rulerz.operator tag, two other values are needed:
target: the compilation target we want to register the operator for ;operator: the name that will be given to the operator in rules.
Important: Operators registered as classes must implement the __invoke
magic method as RulerZ expects custom operators to be defined as callable.
Validators
A rule validator is provided by the bundle. In its simplest form, it will only validate the syntax of a given rule. Unknown variables or operators won't be detected unless you define a whitelist of accepted values.
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert; class TaggingRule { /** * @var string * * @Assert\NotBlank() * @RulerZAssert\ValidRule( * allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"}, * allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or"} * ) */ private $rule; }
Configuration reference
# app/config/config.yml rulerz: cache: "%kernel.cache_dir%/rulerz" debug: "%kernel.debug%" targets: native: false doctrine: false doctrine_dbal: false eloquent: false pomm: false solarium: false elasticsearch: false
The targets section allows you to enable only the compilation targets needed
by your application.
Licence
This bundle is under the MIT licence.
kphoen/rulerz-bundle 适用场景与选型建议
kphoen/rulerz-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 657.78k 次下载、GitHub Stars 达 37, 最近一次更新时间为 2015 年 02 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「doctrine」 「specification」 「ruler」 「rulerz」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kphoen/rulerz-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kphoen/rulerz-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kphoen/rulerz-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Helper that decorates any SUS with a phpspec lazy object wrapper
Symfony RulerZ Bridge
Symfony2 Bundle for RulerZ
The atoum ruler-extension allows you to filter your tests using Hoa\Ruler
Add rule for satisfy objects and generate queries based on specifications.
ContentElement for Contao to generate hr. Simply choose element type "divider" and save.
统计信息
- 总下载量: 657.78k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 37
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-04