willdurand/negotiation
HTTP content negotiation library for PHP. Parses Accept* headers to match the best media type, language, charset, or encoding, with flexible matchers and prioritization. Handy for APIs and middleware to select response formats based on client preferences.
Architecture fit: The package is framework-agnostic and integrates seamlessly with Laravel's HTTP layer, complementing native request/response handling by providing granular control over RFC-compliant content negotiation (e.g., Accept, Accept-Language). It enhances Laravel's default behavior for multi-format APIs without conflicting with core components.
Integration feasibility: High. Composer installation is trivial, and integration requires minimal code changes (e.g., middleware to parse headers and inject negotiated types into requests). Laravel's service container supports easy binding of the negotiation logic.
Technical risk: Moderate. Last release was in 2022, raising concerns about PHP 8.x compatibility and security patching. The "unknown repository" status limits visibility into code quality, issue tracking, and community support. Potential for unaddressed edge cases in header parsing.
Key questions:
Accept directives?Stack fit: Ideal for Laravel's API-focused workflows. Works with existing middleware pipelines, controller responses, and exception handling. No dependency conflicts expected
How can I help you explore Laravel packages today?