PHPackages                             danbettles/php-reggie - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. danbettles/php-reggie

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

danbettles/php-reggie
=====================

Reggie is a very simple regular-expression builder

v3.1.0(3mo ago)0202↓86.7%ISCPHPPHP ^8.3

Since Nov 19Pushed 3mo agoCompare

[ Source](https://github.com/danbettles/php-reggie)[ Packagist](https://packagist.org/packages/danbettles/php-reggie)[ RSS](/packages/danbettles-php-reggie/feed)WikiDiscussions main Synced today

READMEChangelog (6)Dependencies (8)Versions (7)Used By (0)

Reggie 🤴🏻
=========

[](#reggie-)

Reggie is a very simple regular-expression (regex) builder for PHP. It was created to eliminate the clutter and confusion involved in assembling regexes from various different parts, to help prevent hard-to-find bugs and make code easier to understand.

Regexes can be confusing enough: having to also mentally-parse multiple complicated concatenation and interpolation operations makes things many times more difficult. That's where Reggie can help. Its fluent interface breaks things down into more distinct pieces, eliminates a ton of hieroglyphics, makes things more readable.

Examples
--------

[](#examples)

A few examples adapted from real-world code.

Note

For the sake of clarity and brevity, the following code uses literals as inputs. Consequently, some examples may appear simplistic—perhaps even pointless. Indeed, the benefits of using Reggie will become apparent only when regexes must be built from various variables, constants, etc.

### PHP Pathnames

[](#php-pathnames)

```
$regexStr = (new Builder())
    ->caseInsensitive()
    ->anchorEnd()
    ->addLiteral('.php')
    ->buildString()
;

// '~\.php$~i' === $regexStr
```

### Project Paths to Ignore

[](#project-paths-to-ignore)

```
$builder = new Builder();

$regexStr = $builder
    ->anchorStart()
    ->addLiteral("/path/to/project/")
    ->addSubpattern(
        $builder->listOfAlternatives(['vendor', 'var', 'node_modules'], quoteEach: true)
    )
    ->addLiteral('/')
    ->buildString()
;

// '~^/path/to/project/(vendor|var|node_modules)/~' === $regexStr
```

Usage
-----

[](#usage)

### `Builder`

[](#builder)

Generally speaking, the builder class provides two kinds of methods for building a regex:

- methods that change the flags;
- methods that add chunks (patterns or literals).

Important

Methods that add chunks have the prefix "add"; *these must be called in the order you want the chunks to appear in the regex*. Other methods can be called whenever makes sense to you.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance78

Regular maintenance activity

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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 ~22 days

Recently: every ~28 days

Total

6

Last Release

114d ago

Major Versions

v1.0.0 → v2.0.02025-11-19

v2.2.0 → v3.0.02025-11-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/fb4422c02b29b1ae4a4746abb1ebf16c0216d5fc62cf0604e7c6aa4de974b39b?d=identicon)[danbettles](/maintainers/danbettles)

---

Top Contributors

[![danbettles](https://avatars.githubusercontent.com/u/736672?v=4)](https://github.com/danbettles "danbettles (21 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/danbettles-php-reggie/health.svg)

```
[![Health](https://phpackages.com/badges/danbettles-php-reggie/health.svg)](https://phpackages.com/packages/danbettles-php-reggie)
```

###  Alternatives

[wenzhixin/bootstrap-table

An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)

11.8k287.3k1](/packages/wenzhixin-bootstrap-table)[namshi/cuzzle

Get the cURL shell command from a Guzzle request

3342.5M16](/packages/namshi-cuzzle)[pre/plugin

951.5k15](/packages/pre-plugin)

PHPackages © 2026

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