PHPackages                             esi/wildcard - 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. esi/wildcard

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

esi/wildcard
============

A simple wildcard matcher.

v1.0.0(2y ago)11MITPHPPHP ^8.2 &lt;8.5

Since Feb 2Pushed 1y agoCompare

[ Source](https://github.com/ericsizemore/wildcard)[ Packagist](https://packagist.org/packages/esi/wildcard)[ GitHub Sponsors](https://github.com/ericsizemore)[ Fund](https://ko-fi.com/ericsizemore)[ RSS](/packages/esi-wildcard/feed)WikiDiscussions master Synced 1mo ago

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

Simple wildcard component
=========================

[](#simple-wildcard-component)

Important

This library is now archived, with no current plans to maintain it.

This project aims to provide a dead simple component for php to support wildcards. Wildcards are \* (zero or more characters) and ? (exactly one character). The component is not tied to filenames. You can use it also for namespaces, urls and other strings.

Why can't you just provide a simple function for this?
------------------------------------------------------

[](#why-cant-you-just-provide-a-simple-function-for-this)

Because of effectivity. When you create an instance of the `Wildcard`-class, you also "compile" the pattern. This means that I try to find the optimal test method for your later input. So if you run the same pattern more often in the same run, you could benefit from that optimization. If not, the Interface should still be simple enough to make you happy. If not, go wrap a function around it.

Why not just use regular expressions?
-------------------------------------

[](#why-not-just-use-regular-expressions)

Because there is no reason to use regular expressions for the most common figures:

`string*` means "starts with". `*string` means "ends with".

So even if I use regular expressions to cover complex patterns, it is too pointless to use regular expressions for one of these. If you like to provide more speedups for such simple patterns, feel free to push me some.

Composer:
---------

[](#composer)

```
composer require esi/wildcard ^1.0

```

Example:
--------

[](#example)

```
use Esi\Wildcard\Wildcard;

(new Wildcard('test.*'))->match('test.txt');      // true
Wildcard::create('test.*')->match('test.txt');    // true
Wildcard::create('*.txt')->match('test.txt');     // true
Wildcard::create('*.*')->match('test.txt');       // true
Wildcard::create('test*txt')->match('test.txt');  // true
Wildcard::create('test?txt')->match('test.txt');  // true
Wildcard::create('t*.???')->match('test.txt');    // true
Wildcard::create('t*t?.txt')->match('test8.txt'); // true
```

About
-----

[](#about)

### Requirements

[](#requirements)

- PHP 8.2.0 or above.

### Submitting bugs and feature requests

[](#submitting-bugs-and-feature-requests)

Bugs and feature requests are tracked on [GitHub](https://github.com/ericsizemore/wildcard/issues)

Issues are the quickest way to report a bug. If you find a bug or documentation error, please check the following first:

- That there is not an Issue already open concerning the bug
- That the issue has not already been addressed (within closed Issues, for example)

### Contributing

[](#contributing)

Wildcard accepts contributions of code and documentation from the community. These contributions can be made in the form of Issues or [Pull Requests](http://help.github.com/send-pull-requests/) on the [Wildcard repository](https://github.com/ericsizemore/wildcard).

Wildcard is licensed under the MIT license. When submitting new features or patches to Wildcard, you are giving permission to license those features or patches under the MIT license.

Wildcard tries to adhere to PHPStan level 9 with strict rules and bleeding edge. Please ensure any contributions do as well.

#### Guidelines

[](#guidelines)

Before we look into how, here are the guidelines. If your Pull Requests fail to pass these guidelines it will be declined, and you will need to re-submit when you’ve made the changes. This might sound a bit tough, but it is required for me to maintain quality of the code-base.

#### PHP Style

[](#php-style)

Please ensure all new contributions match the [PSR-12](https://www.php-fig.org/psr/psr-12/) coding style guide. The project is not fully PSR-12 compatible, yet; however, to ensure the easiest transition to the coding guidelines, I would like to go ahead and request that any contributions follow them.

#### Documentation

[](#documentation)

If you change anything that requires a change to documentation then you will need to add it. New methods, parameters, changing default values, adding constants, etc. are all things that will require a change to documentation. The change-log must also be updated for every change. Also, PHPDoc blocks must be maintained.

##### Documenting functions/variables (PHPDoc)

[](#documenting-functionsvariables-phpdoc)

Please ensure all new contributions adhere to:

- [PSR-5 PHPDoc](https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md)
- [PSR-19 PHPDoc Tags](https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc-tags.md)

when documenting new functions, or changing existing documentation.

#### Branching

[](#branching)

One thing at a time: A pull request should only contain one change. That does not mean only one commit, but one change - however many commits it took. The reason for this is that if you change X and Y but send a pull request for both at the same time, we might really want X but disagree with Y, meaning we cannot merge the request. Using the Git-Flow branching model you can create new branches for both of these features and send two requests.

### Author

[](#author)

Eric Sizemore -  -

### License

[](#license)

Wildcard is licensed under the MIT License - see the `LICENSE.md` file for details

### Acknowledgements / Credits

[](#acknowledgements--credits)

This repository is a fork of [rkrx/php-wildcards](https://github.com/rkrx/php-wildcards). Thanks to them and all the contributors!

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.1% 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

Unknown

Total

1

Last Release

836d ago

### Community

Maintainers

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

---

Top Contributors

[![ericsizemore](https://avatars.githubusercontent.com/u/723810?v=4)](https://github.com/ericsizemore "ericsizemore (11 commits)")[![rkrx](https://avatars.githubusercontent.com/u/5672982?v=4)](https://github.com/rkrx "rkrx (6 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (1 commits)")

---

Tags

wildcardwildcards

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/esi-wildcard/health.svg)

```
[![Health](https://phpackages.com/badges/esi-wildcard/health.svg)](https://phpackages.com/packages/esi-wildcard)
```

###  Alternatives

[rkr/wildcards

A simple wildcard matcher

1418.3k](/packages/rkr-wildcards)[hamburgscleanest/guzzle-advanced-throttle

A Guzzle middleware that can throttle requests according to (multiple) defined rules. It is also possible to define a caching strategy, e.g. get response from cache when rate limit is exceeded or always get cached value to spare your rate limits.

13033.4k1](/packages/hamburgscleanest-guzzle-advanced-throttle)[hamburgscleanest/laravel-guzzle-throttle

A Laravel wrapper for https://github.com/hamburgscleanest/guzzle-advanced-throttle.

7914.3k](/packages/hamburgscleanest-laravel-guzzle-throttle)[damodar-bhattarai/settings

Package to store and get general website settings on the fly.

312.2k](/packages/damodar-bhattarai-settings)

PHPackages © 2026

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