composer/pcre
Type-safe wrapper around PHP’s preg_* functions. Composer\Pcre\Preg prevents silent PCRE failures, standardizes return types (PREG_UNMATCHED_AS_NULL), and improves static analysis with a PHPStan extension for regex-aware typing.
Architecture fit: Excellent for Laravel applications as it provides type-safe, object-oriented alternatives to native preg_* functions without disrupting existing PHP workflows. Integrates seamlessly into service layers, validators, or custom helpers where regex is used, reducing boilerplate and improving code clarity. The package now includes explicit PHPStan 2 compatibility, reinforcing its alignment with modern PHP tooling and static analysis.
Integration feasibility: High via Composer installation. The release notes confirm the package is actively maintained under the composer/pcre repository (previously ambiguous), resolving legitimacy concerns. Public repository access enables code review, contribution, and transparency. The package remains Laravel-agnostic but is fully compatible with its ecosystem.
Technical risk:
preg_* functions (requires validation in test suites).Key questions:
Stack fit:
Migration path:
Illuminate/Validation).preg_* results using property-based testing.composer.json and replace patterns incrementally via search/replace (with manual review for edge cases).Compatibility:
ext/pcre (unlikely, as this is a wrapper).Sequencing:
Maintenance:
Support:
PcreException).Scaling:
Failure Modes:
// Example: Compare outputs
assert($package->match('/\p{L}/u', $string) === preg_match('/\p{L}/u', $string, $matches));
Ramp-up:
Pcre::match(), Pcre::quote()).REGEX_STANDARD.md to the codebase with:
How can I help you explore Laravel packages today?