Weave Code
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

Php Matcher Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Data Validation & Parsing: Accelerates development of robust validation pipelines for APIs, CLI tools, or internal systems by reducing custom regex/XML/JSON parsing logic. Ideal for teams handling unstructured or semi-structured data (e.g., logs, user-generated content, or third-party integrations). The PHP 8.5 support and Symfony 8.0 compatibility make it a future-proof choice for modern PHP ecosystems.
  • Roadmap Efficiency: Enables rapid prototyping of pattern-matching features (e.g., "match invoices with missing fields" or "flag malformed API responses") without reinventing the wheel. The dropped support for PHP < 8.3 aligns with industry trends toward newer PHP versions, reducing long-term maintenance overhead.
  • Build vs. Buy: Justifies buying this package over custom solutions for teams with:
    • Frequent data-matching needs (e.g., fraud detection, compliance checks).
    • Tight deadlines for validation-heavy features.
    • Limited PHP expertise to maintain regex/XML parsers long-term.
    • New: Teams already using Symfony 8.0 or planning to adopt it, as this release ensures seamless integration.
  • Use Cases:
    • API Gateways: Validate incoming payloads against dynamic schemas (e.g., OpenAPI + custom rules).
    • ETL Pipelines: Sanitize/transform messy data (e.g., CSV imports, web scrapes).
    • Debugging Tools: Build interactive "data diff" tools for support teams.
    • Legacy System Modernization: Replace brittle string operations in old PHP codebases.
    • New: Symfony 8.0 Projects: Leverage this package for validation in Symfony applications without additional abstraction layers.

When to Consider This Package

Adopt if:

  • Your team frequently writes ad-hoc validation logic (regex, str_contains, manual XML parsing) that’s hard to maintain.
  • You need human-readable patterns (e.g., "{name: /[A-Z][a-z]+/}") instead of cryptic regex or XPaths.
  • Your data sources are varied or unpredictable (e.g., partner APIs, user uploads, logs).
  • You’re using Laravel or Symfony 8.0 and want to avoid JavaScript-based tools (e.g., JSONPath libraries).
  • New: Your team is migrating to PHP 8.3+ or already uses it, as this release drops support for older versions.
  • New: You require modern PHP tooling (e.g., Nix-based development environments, as indicated by the nix-shell addition).

Look elsewhere if:

  • You require high-performance matching (e.g., real-time stream processing) where this package’s overhead is prohibitive.
  • Your data is strictly structured (e.g., relational databases) and ORMs/validation libraries (like Laravel’s Validator) suffice.
  • You need advanced transformations (e.g., complex ETL) beyond pattern matching (consider Symfony Serializer or Spatie’s ArrayToXml).
  • Your team lacks PHP expertise to debug matcher syntax or integrate it with existing code.
  • New: You are stuck on PHP < 8.3, as this release drops support for older versions.
  • New: You rely on Symfony < 8.0 and need deep integration with older Symfony components.

How to Pitch It (Stakeholders)

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:

  • PHP 8.5 & Symfony 8.0 Support: Future-proof your validation logic.
  • Dropped PHP < 8.3: Aligns with modern PHP best practices (no more legacy baggage).
  • Laravel/Symfony-Friendly: Integrates seamlessly with Validator, FormRequest, or standalone.
  • Multi-format: Works with JSON, XML, or plain text (e.g., match('{email: /^[^@]+@[^@]+\.[^@]+$/}')).
  • Extensible: Supports custom matchers (e.g., date formats, business rules).
  • Debugging: Clear error messages pinpoint mismatches (e.g., ‘Field 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."*
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky