PHPackages                             derrabus/ereg-shim - 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. derrabus/ereg-shim

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

derrabus/ereg-shim
==================

Replacement for the ereg legacy php extension.

v1.1.0(5y ago)11105.6k—10%2MITPHPPHP &gt;=5.3CI passing

Since Dec 31Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/derrabus/php-ereg-shim)[ Packagist](https://packagist.org/packages/derrabus/ereg-shim)[ RSS](/packages/derrabus-ereg-shim/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (1)Dependencies (1)Versions (5)Used By (0)

php ereg shim
=============

[](#php-ereg-shim)

This package emulates the old php extension for POSIX regular expressions (ereg) if it's not available. Internally, the PCRE extension is used to process regular expressions.

Requirements and Usage
----------------------

[](#requirements-and-usage)

The library requires php 5.3 or newer. To add it to your projects, simply add `derrabus/ereg-shim` to your composer dependencies.

```
composer require derrabus/ereg-shim

```

This should auto-register the shim for you. However, it remains inactive as long as the ereg extension is active. It should be safe to include it in projects that should be tested on php 5 and php 7/8 simultaneously.

You can also force the usage of the shim implementation on php 5 by directly calling the corresponding methods on the `Rabus\EregShim\Ereg` class.

Global function callForced shimmed function call`ereg('[0-9][^0-9]', '2a')``\Rabus\EregShim\Ereg::ereg('[0-9][^0-9]', '2a')`Purpose and limitations
-----------------------

[](#purpose-and-limitations)

This library can be helpful if you need to quicky migrate a legacy codebase to php 7.0 and beyond. It will be slower than the native implementation and is not intended to be a permanent solution. Code that depends on the ereg extension should be refactored to use the corresponding PCRE functions instead.

The library has been developed against the test suite of the php 5.6 ereg extension in order to get as close to the original behavior as possible. While PCRE and POSIX regular expressions are very similar, they're not 100% compatible. There are certain edge cases that this library cannot cover.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance47

Moderate activity, may be stable

Popularity39

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

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

Total

4

Last Release

1944d ago

PHP version history (3 changes)v1.0PHP ^5.3 || ^7

v1.0.2PHP ^5.3 || ^7 || ^8

v1.1.0PHP &gt;=5.3

### Community

Maintainers

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

---

Top Contributors

[![derrabus](https://avatars.githubusercontent.com/u/1506493?v=4)](https://github.com/derrabus "derrabus (25 commits)")

---

Tags

legacyphppolyfillregular-expressionsshim

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/derrabus-ereg-shim/health.svg)

```
[![Health](https://phpackages.com/badges/derrabus-ereg-shim/health.svg)](https://phpackages.com/packages/derrabus-ereg-shim)
```

###  Alternatives

[cobaltgrid/vatsim-stand-status

A PHP library to access the status of aircraft stands on VATSIM

188.9k](/packages/cobaltgrid-vatsim-stand-status)

PHPackages © 2026

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