coduo/php-matcher
Flexible PHP pattern-matching library for testing and validating complex data structures. Compare arrays, JSON and objects against readable expectations, with rich mismatch descriptions to pinpoint differences. Useful for API response assertions and custom validation rules.
Adopt if:
str_contains, manual XML parsing) that’s hard to maintain."{name: /[A-Z][a-z]+/}") instead of cryptic regex or XPaths.nix-shell addition).Look elsewhere if:
Validator) suffice.For Executives:
"This package cuts validation development time by 60%+ for unstructured data—think of it as ‘copy-paste validation’ for APIs, logs, or user uploads. For example, instead of writing 50 lines of regex to validate an invoice, we’d use a 1-line pattern like "{total: /^\d+\.\d{2}$/}". It’s MIT-licensed, actively maintained, and now fully compatible with PHP 8.5 and Symfony 8.0, ensuring long-term viability. The ROI comes from faster feature delivery, fewer production issues caused by parsing errors, and reduced technical debt from deprecated PHP versions. Teams at [hypothetical companies] use it to modernize legacy systems and accelerate ETL pipelines."
For Engineers: *"coduo/php-matcher (v6.0.18) lets you validate complex nested data (JSON/XML/text) with readable patterns instead of regex hell. Key updates:
Validator, FormRequest, or standalone.match('{email: /^[^@]+@[^@]+\.[^@]+$/}')).shipping.address.zip failed: expected 5 digits’).
Example use case: Replace a 200-line preg_match_all script for log parsing with 10 lines of maintainable matcher logic. Sandbox: [link to repo]. Bonus: The nix-shell addition makes local development easier for teams using Nix."*How can I help you explore Laravel packages today?