PHPackages                             c01l/formal-theory - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. c01l/formal-theory

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

c01l/formal-theory
==================

FormalTheory is a library that allows for manipulation and conversion of NFAs, DFAs and Regular Expressions.

2.3.0(4y ago)0190MITPHPPHP &gt;=7.3

Since Nov 26Pushed 4y agoCompare

[ Source](https://github.com/c01l/FormalTheory)[ Packagist](https://packagist.org/packages/c01l/formal-theory)[ Docs](https://github.com/witrin/FormalTheory)[ RSS](/packages/c01l-formal-theory/feed)WikiDiscussions master Synced 1mo ago

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

FormalTheory
============

[](#formaltheory)

FormalTheory is a library that allows for manipulation and conversion of NFAs, DFAs and Regular Expressions. Some of the features it includes are:

- Regex Lexing (AST)
- Regex to NFA conversion
- NFA to DFA conversion (determinize)
- DFA minimization
- DFA solution counting
- FA equality
- FA superset/subset test
- FA proper superset/subset test
- FA has a valid solution
- FA print
- FA export as DOT
- FA string matching
- FA intersections
- FA unions
- FA negation
- FA reverse
- FA to Regex conversion (basic)
- Heavy Unit Test Coverage
- Modern Autoloading Support
- Regex optimization via rules

Note: FA is either a DFA or NFA

Coming Soon™

- Regex optimization via mutations
- Generalized DFA solving based on positive/negative match list

[![Build Status](https://camo.githubusercontent.com/f44be30f2744015abbcec26493b066b82ff4cc55cb521581e168fbd983b94595/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f4b656e64616c6c486f706b696e732f466f726d616c5468656f72792e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/KendallHopkins/FormalTheory)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 97.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

Every ~452 days

Total

5

Last Release

1641d ago

Major Versions

1.1.0 → 2.0.02021-11-06

PHP version history (2 changes)1.1.0PHP &gt;=5.3.0

2.0.0PHP &gt;=7.3

### Community

Maintainers

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

---

Top Contributors

[![KendallHopkins](https://avatars.githubusercontent.com/u/72923?v=4)](https://github.com/KendallHopkins "KendallHopkins (99 commits)")[![c01l](https://avatars.githubusercontent.com/u/17108962?v=4)](https://github.com/c01l "c01l (2 commits)")[![vojtech-dobes](https://avatars.githubusercontent.com/u/415925?v=4)](https://github.com/vojtech-dobes "vojtech-dobes (1 commits)")

---

Tags

lexerstateexpressionregexregulartransformfiniteoptimizerdeterministicformaltheorydfanfafanondeterministicautomata

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/c01l-formal-theory/health.svg)

```
[![Health](https://phpackages.com/badges/c01l-formal-theory/health.svg)](https://phpackages.com/packages/c01l-formal-theory)
```

###  Alternatives

[kendall-hopkins/formal-theory

FormalTheory is a library that allows for manipulation and conversion of NFAs, DFAs and Regular Expressions.

335.4k](/packages/kendall-hopkins-formal-theory)[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k910.8M118](/packages/doctrine-lexer)[spatie/regex

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

1.1k17.1M59](/packages/spatie-regex)[cerbero/json-parser

Zero-dependencies pull parser to read large JSON from any source in a memory-efficient way.

803474.6k5](/packages/cerbero-json-parser)[rawr/t-regx

PHP regular expression brought up to modern standards.

451157.3k3](/packages/rawr-t-regx)[nxp/math-executor

Simple math expressions calculator

2281.7M7](/packages/nxp-math-executor)

PHPackages © 2026

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