Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Regex Laravel Package

hoa/regex

Hoa\Regex is a PHP library for working with regular expressions at the grammar level. It parses patterns into an AST, offers visitors and generators, and supports analyzing, manipulating, and compiling regexes for advanced tooling.

View on GitHub
Deep Wiki
Context7

Hoa\Regex is a PHP library for working with regular expressions programmatically. Built on the Hoa compiler stack, it parses regex patterns into a structured abstract syntax tree (AST) and provides visitors to inspect or traverse them, making regexes easier to analyze and integrate into tooling.

  • Parse regular expressions into a structured AST
  • Generate strings that match a given pattern
  • Traverse and transform regexes with visitors
  • Useful for testing, fuzzing, and data generation
  • Integrates with other Hoa components
Frequently asked questions about Regex
Does hoa/regex work with Laravel?
There is no Laravel service provider, facade, config file, or contract — hoa/regex is a framework-agnostic PHP library that only needs PSR-4 autoloading. You integrate it yourself by defining an interface in your domain terms, writing a thin adapter around the Hoa classes, and binding that adapter in a service provider. Keep all Hoa\Regex types inside the adapter so the dependency stays swappable. Do not put it in controllers or jobs that serve user traffic.
How do I install hoa/regex with Composer?
Run composer require hoa/regex, but be aware it pulls a large abandoned transitive tree including hoa/compiler, hoa/ustring, hoa/math, hoa/stream, hoa/zformat, hoa/consistency, hoa/iterator, and hoa/exception. Composer 2 will flag the package as abandoned at install time. All of those dependencies come from the same defunct project, so the risk compounds rather than staying local.
Is hoa/regex still maintained?
No. The last release was 2017-01-13, the GitHub repository is archived, and the dataset shows zero dependents, which strongly suggests nobody is exercising this code against modern PHP. There is no upstream maintainer to patch bugs or compatibility issues. If you adopt it, plan to own a fork with a named maintainer and a review date.
Can hoa/regex parse modern PCRE2 patterns?
Probably not reliably. PHP moved to PCRE2 in 7.3, but hoa/regex ships a 2017-era PCRE grammar, so it may mis-parse constructs that are valid today. The dangerous part is that an unmaintained grammar tends to produce silent mis-parses rather than loud failures. Test against a realistic corpus of the exact patterns you care about before trusting the AST.
What are realistic use cases for hoa/regex in a Laravel app?
Good fits are generating fixture or fuzz data from regexes in tests and seeders, validating or analysing user-authored patterns such as promo codes or SKU masks, and building a grammar or DSL feature where the AST is the point. It is a poor fit for anything the HTTP hot path depends on, because parsing is LL(k) grammar work and generation can be unbounded. Keep it in tests, database factories, or an Artisan command.
How do I generate random strings matching a regex with hoa/regex?
The library includes an isotropic visitor that samples random strings matching a pattern, which you can call from your adapter. Be careful: sampling with *, +, and nested quantifiers can be unbounded and exhaust memory or hang a PHP-FPM worker. Never feed it untrusted patterns in-process, and consider Faker's regexify() for simple, known pattern shapes.
Is hoa/regex safe to use in production request handling?
No — treat it as build-time or test tooling only. Catastrophic backtracking and unbounded sampling mean a single hostile or badly written pattern can hang a worker, and there is no caching layer or Laravel-aware ergonomics to soften that. There is also no security-advisory channel, so composer audit gives a false sense of coverage. If it must run at runtime, isolate it behind a queue or a separate process with strict limits.
What alternatives to hoa/regex should I evaluate?
For parsing and analysing patterns, look at s9e/regexp, which is actively maintained. For simple string generation, Faker's regexify() is usually enough, and for narrow, known pattern shapes a hand-rolled generator is often safer. Run your real pattern corpus through both your hoa/regex adapter and the alternative, then diff the outputs before deciding.
Why is hoa/regex marked abandoned and does that affect security audits?
The whole Hoa project is defunct — the repository is archived and no releases have shipped since 2017 — so Composer 2 flags it as abandoned on install. Because there is no security-advisory channel, composer audit will not warn you about vulnerabilities in this package or its abandoned dependencies. That means your governance process needs an explicit exception and a review date rather than relying on tooling.
How should I spike or integrate hoa/regex safely?
Run a timeboxed two-to-three day spike on your target PHP version: install it, sample a realistic pattern corpus, and confirm parse success and generation behaviour. In parallel, implement the same interface with an actively maintained alternative and diff outputs on the corpus. Then decide between adopt-with-fork, tooling-only, or replace, and if you adopt, keep every Hoa type behind your own interface.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core