spatie/regex
Cleaner, safer wrapper around PHP’s preg_* functions. Provides Regex::match/matchAll/replace with MatchResult objects, easy access to groups, sensible defaults, and callback-based replacements—no by-reference variables or confusing false/null error handling.
The package is now verifiably hosted on GitHub at spatie/regex, resolving the critical "unknown repository" red flag. The repository is actively maintained by Spatie, a reputable Laravel ecosystem contributor, with:
Architecture Fit:
preg_* functions, reducing boilerplate for regex operations in Laravel.Integration Feasibility:
preg_match with Regex::match()).Key Questions:
preg_* functions for high-throughput regex operations?Stack Fit:
Regex::setPattern()).Migration Path:
Regex::match(), Regex::replace(), etc.
// Before
preg_match('/pattern/', $input, $matches);
// After
Regex::match('/pattern/', $input)->matches();
spatie/regex:^3.1.Compatibility:
Sequencing:
preg_* calls via static analysis (e.g., PHPStan).Maintenance:
Support:
preg_* functions remain viable if package fails.Scaling:
preg_* for high-load scenarios (e.g., bulk regex processing).preg_* functions are inherently safe).Failure Modes:
^3.1 to avoid unexpected updates.Ramp-Up:
preg_* in new code).How can I help you explore Laravel packages today?