PHPackages                             blmage/magento2-rule-operators - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. blmage/magento2-rule-operators

ActiveMagento2-module[Validation &amp; Sanitization](/categories/validation)

blmage/magento2-rule-operators
==============================

Additional rule operators for Magento 2 (matches regex, starts/ends with)

1.1.0(6y ago)81.1k↓50%1[1 PRs](https://github.com/blmage/magento2-rule-operators/pulls)OSL-3.0PHPPHP &gt;=7.0

Since May 21Pushed 5y ago1 watchersCompare

[ Source](https://github.com/blmage/magento2-rule-operators)[ Packagist](https://packagist.org/packages/blmage/magento2-rule-operators)[ Docs](https://www.github.com/blmage/magento2-rule-operators)[ RSS](/packages/blmage-magento2-rule-operators/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Additional rule operators for Magento 2
=======================================

[](#additional-rule-operators-for-magento-2)

Installation
------------

[](#installation)

The extension must be installed via `composer`. To proceed, run these commands in your terminal:

```
composer require blmage/magento2-rule-operators
php bin/magento module:enable BL_RuleOperators
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

```

Documentation
-------------

[](#documentation)

This extension adds new operators (along with their negative variants):

- starts with
- ends with
- matches regular expression

to any rule condition based on `Magento\Rule\Model\Condition\AbstractCondition`. This includes conditions from:

- catalog price rules
- catalog widget rules
- cart price rules

### Starts / ends with

[](#starts--ends-with)

This is the same as the original "contains" operator, except that the searched value must be strictly located respectively at the start or at the end of the tested value.

### Matches regular expression

[](#matches-regular-expression)

This performs a test based on a [PCRE regular expression](http://php.net/manual/en/reference.pcre.pattern.syntax.php). You can either supply:

- just a pattern (eg: `^59\d{3}$`), which will applied with the `i` (case insensitivity) and `u` (UTF-8) modifiers. Note that you do not have to worry about which delimiter is actually used, as they will automatically be escaped in your pattern.
- a full regex, including (valid) delimiters and modifiers (eg: `/^59\d{3}$/D`), which will be used as-is. This is especially useful when you want to have full control over the used [modifiers](http://php.net/manual/en/reference.pcre.pattern.modifiers.php).

Support / Suggestions
---------------------

[](#support--suggestions)

If you encounter a bug, or if you have a suggestion regarding a new operator, don't hesitate to post an [issue](https://github.com/blmage/magento2-rule-operators/issues/new)!

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~704 days

Total

2

Last Release

2205d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1af47eccc44b8eb19c01c3bf64fc20761b8610d22bbc8d94bf844449241398c5?d=identicon)[blmage](/maintainers/blmage)

---

Top Contributors

[![blmage](https://avatars.githubusercontent.com/u/25432517?v=4)](https://github.com/blmage "blmage (6 commits)")[![fnogatz](https://avatars.githubusercontent.com/u/881988?v=4)](https://github.com/fnogatz "fnogatz (2 commits)")

---

Tags

magentooperatorsregexrulesmagentoregexrulesconditionsoperators

### Embed Badge

![Health badge](/badges/blmage-magento2-rule-operators/health.svg)

```
[![Health](https://phpackages.com/badges/blmage-magento2-rule-operators/health.svg)](https://phpackages.com/packages/blmage-magento2-rule-operators)
```

###  Alternatives

[ruler/ruler

A simple stateless production rules engine for modern PHP.

1.1k794.6k3](/packages/ruler-ruler)[mi-schi/phpmd-extension

Contains extra phpmd rules from clean code book and the best practices of my experiences.

40882.0k5](/packages/mi-schi-phpmd-extension)[resultsystems/validation

Inspired 'KennedyTedesco Validation' - The power of 'Respect Validation' on Laravel.

2832.4k4](/packages/resultsystems-validation)[suin/php-cs-fixer-rules

A Rule set for PHP-CS-Fixer mainly targeting PHP 7.1 or higher.

13116.7k3](/packages/suin-php-cs-fixer-rules)[hybridlogic/validation

A simple, extensible validation library for PHP with support for filtering and validating any input array along with generating client side validation code.

641.1k](/packages/hybridlogic-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
