PHPackages                             antalaron/regex-validator - 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. antalaron/regex-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

antalaron/regex-validator
=========================

PHP library to validate regular expressions

v1.1.0(4y ago)06.7k—3.6%MITPHPPHP ^7.4|^8.0

Since Dec 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/antalaron/regex-validator)[ Packagist](https://packagist.org/packages/antalaron/regex-validator)[ RSS](/packages/antalaron-regex-validator/feed)WikiDiscussions master Synced 1mo ago

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

Regular expression validator
============================

[](#regular-expression-validator)

[![Build Status](https://camo.githubusercontent.com/0ec97ad645b75df6955b2c857b34585c5abf6f7d1ae4e370b687d882c22b4376/68747470733a2f2f7472617669732d63692e6f72672f616e74616c61726f6e2f72656765782d76616c696461746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/antalaron/regex-validator) [![Coverage Status](https://camo.githubusercontent.com/6fc70e298bff4b8a621f6aef6ca5c5106595b58b0fad9a5016003c3ed4788337/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f616e74616c61726f6e2f72656765782d76616c696461746f722f62616467652e737667)](https://coveralls.io/github/antalaron/regex-validator?branch=master) [![Latest Stable Version](https://camo.githubusercontent.com/14bd7ba4d846fea82ac8283bf4966a55b351f141bae97d626a2e6230d4de174f/68747470733a2f2f706f7365722e707567782e6f72672f616e74616c61726f6e2f72656765782d76616c696461746f722f762f737461626c65)](https://packagist.org/packages/antalaron/regex-validator) [![Latest Unstable Version](https://camo.githubusercontent.com/f109a1dd5a9076f3437dc0da3423a29cfa560ecf81dcc4f69f6a4ded62fae621/68747470733a2f2f706f7365722e707567782e6f72672f616e74616c61726f6e2f72656765782d76616c696461746f722f762f756e737461626c65)](https://packagist.org/packages/antalaron/regex-validator) [![License](https://camo.githubusercontent.com/a098b1a0f842d14c758946731c83288f772180c19887b3bfbc001e6aa05c52b1/68747470733a2f2f706f7365722e707567782e6f72672f616e74616c61726f6e2f72656765782d76616c696461746f722f6c6963656e7365)](https://packagist.org/packages/antalaron/regex-validator)

PHP library to validate regular expressions.

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

[](#installation)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:

```
$ composer require antalaron/regex-validator
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Basic usage
-----------

[](#basic-usage)

To validate a regular expression:

```
use Antalaron\RegexValidator\Regex;
use Symfony\Component\Validator\Validation;

$validator = Validation::createValidator();
$violations = $validator->validate('/foo/', new Regex());

if (0 !== count($violations)) {
    foreach ($violations as $violation) {
        echo $violation->getMessage().'';
    }
}
```

License
-------

[](#license)

This library is under [MIT License](http://opensource.org/licenses/mit-license.php).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~1524 days

Total

2

Last Release

1566d ago

PHP version history (2 changes)v1.0.0PHP ^5.6|^7.0

v1.1.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/464e80a7b766518129809bfb8ac8b22e8c51d274d66f2423d66520772413134c?d=identicon)[antalaron](/maintainers/antalaron)

---

Top Contributors

[![antalaron](https://avatars.githubusercontent.com/u/9386504?v=4)](https://github.com/antalaron "antalaron (6 commits)")

---

Tags

libraryphpregex-validatorregular-expressionsymfony-validatorvalidation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/antalaron-regex-validator/health.svg)

```
[![Health](https://phpackages.com/badges/antalaron-regex-validator/health.svg)](https://phpackages.com/packages/antalaron-regex-validator)
```

###  Alternatives

[sllh/iso-codes-validator

Symfony validator wrapper of ronanguilloux/isocodes

37299.8k2](/packages/sllh-iso-codes-validator)[digitalrevolution/symfony-validation-shorthand

Validation shorthand for symfony

12108.5k2](/packages/digitalrevolution-symfony-validation-shorthand)[digitalrevolution/symfony-request-validation

Automatic request validation for symfony

1296.0k](/packages/digitalrevolution-symfony-request-validation)

PHPackages © 2026

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