承接 kphoen/rulerz-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kphoen/rulerz-bundle

最新稳定版本:0.15.0

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.

统计信息

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

GitHub 信息

  • Stars: 38
  • Watchers: 3
  • Forks: 27
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固