PHPackages                             ft/rfc\_abnf - 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. ft/rfc\_abnf

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

ft/rfc\_abnf
============

Lightweight RFC ABNF Syntax and Regex Patterns

1.0.0(3y ago)08MITPHPPHP &gt;=8.1

Since Aug 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/soulshined/ft-rfc-abnf)[ Packagist](https://packagist.org/packages/ft/rfc_abnf)[ RSS](/packages/ft-rfc-abnf/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

This is a growing resource that is always changing and will always have something that needs to be adjusted or a new spec that needs to be added. That is inherently the nature of RFC.

Please keep that in mind.

Overview
--------

[](#overview)

There are two conceptual offerings of this library

1. Capturing the RFC specs in model form
2. Provide a single but flexible way for building regex patterns around any spec's ABNF notation

Capturing the RFC specs in model form
-------------------------------------

[](#capturing-the-rfc-specs-in-model-form)

The models **must** honor the following rules:

- All RFC spec based classes inherit `FT\RFC_ABNF\Core`
- The name of the class will be the name of the spec
- The classes **must** be self-documenting. The name of the class methods will be the name of the ABNF rule identifier provided in the spec's grammar

    For example, if the spec denotes the following rules:

    ```
    OWS = *(SP / HTAB )
    time-of-day = hour ':' minute ':' second

    ```

    They will be reflected in the class as such:

    ```
    public static function OWS() : ABNF;
    public static function TIME_OF_DAY() : ABNF;
    ```
- All ABNF rule class methods will return an `FT\RFC_ABNF\ABNF` object
- All ABNF rule class methods will be static
- It is not the goal of this library to capture all the spec's ABNF rules in the model out-of-box, but the fundamentaly building blocks of the spec's ABNF *will* be captured so to be able to build patterns with them.

    For example, in RFC9110 there is a rule for `Trailer`:

    ```
    Trailer = [ field-name *( OWS "," OWS field-name ) ]

    ```

    A rule like this generally won't be focused on because you can build a regexp using the fundamental rules of `field-name` and `OWS` as they are provided.

    Moving forward, the goal is to facilitate all rules a spec mentions

Provide a single flexible way for building spec related regex patterns
----------------------------------------------------------------------

[](#provide-a-single-flexible-way-for-building-spec-related-regex-patterns)

- You can build regexp for respective RFC specs using one of the two following patterns:

    - The builder method pattern

        ```
        (new RegexBuilder(Specs::RFC9110))
            ->with("DQUOTE")
            ->group(
                (new RegexBuilder(Specs::RFC9110))
                    ->with("qdtext")
                    ->text("|")
                    ->with("quoted-pair")
            )
            ->with("DQUOTE")
            ->build()
        ```
    - The ABNF expression pattern using template variables

        ```
        (new RegexBuilder(Specs::RFC9110))
            ->abnf(":dquote (?::qdtext|:quoted-pair)* :dquote")
            ->build();
        ```

    Review the [wiki for complete documentation](https://github.com/soulshined/ft-rfc-abnf/wiki/Documentation)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Unknown

Total

1

Last Release

1366d ago

### Community

Maintainers

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

---

Top Contributors

[![soulshined](https://avatars.githubusercontent.com/u/11242654?v=4)](https://github.com/soulshined "soulshined (1 commits)")

---

Tags

regexregexprfcabnf

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ft-rfc-abnf/health.svg)

```
[![Health](https://phpackages.com/badges/ft-rfc-abnf/health.svg)](https://phpackages.com/packages/ft-rfc-abnf)
```

###  Alternatives

[composer/pcre

PCRE wrapping library that offers type-safe preg\_\* replacements.

693313.8M34](/packages/composer-pcre)[spatie/regex

A sane interface for php's built in preg\_\* functions

1.1k17.1M59](/packages/spatie-regex)[gherkins/regexpbuilderphp

PHP port of thebinarysearchtree/regexpbuilderjs

1.4k163.0k1](/packages/gherkins-regexpbuilderphp)[regex-guard/regex-guard

A wrapper that allows you to validate regular expressions and handle normally uncatchable PCRE compilation warnings

24509.2k8](/packages/regex-guard-regex-guard)[kozz/emoji-regex

Emoji regex parser

31171.2k](/packages/kozz-emoji-regex)[bassim/super-expressive-php

A PHP port of https://github.com/francisrstokes/super-expressive

2611.3k](/packages/bassim-super-expressive-php)

PHPackages © 2026

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