A standalone PHP library for implementing RFC 7231 compliant content negotiation (media type, language, encoding, charset).
Negotiation is a PHP library that implements content negotiation as defined in RFC 7231, allowing servers to automatically select the best response format (media type, language, encoding, or charset) based on client HTTP headers. It solves the problem of handling multiple client preferences in APIs and web applications without manual parsing.
PHP developers building RESTful APIs, web applications, or middleware that need to support content negotiation for internationalization, format selection, or HTTP compliance.
Developers choose Negotiation because it's a lightweight, dependency-free library with strict RFC compliance, comprehensive unit tests, and an intuitive API that works with any PHP framework or custom application.
Content Negotiation tools for PHP.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Strictly adheres to the standard for content negotiation, ensuring correct handling of Accept headers with quality values and parameters, as demonstrated in the media type and charset examples.
Has no external dependencies, making it easy to integrate into any PHP project without bloating the codebase, as emphasized in the README's framework-agnostic philosophy.
Comprehensively tested for reliability, with a CI badge and setup instructions for running tests, reducing bugs in production use.
Provides uniform methods like getBest(), getValue(), and getQuality() across all negotiator classes, simplifying implementation across media, language, encoding, and charset negotiation.
Major versions (1.x and 2.x) are end-of-life with no support, forcing potentially difficult upgrades for existing projects, as highlighted in the versioning section with separate documentation.
Lacks built-in integrations with popular PHP frameworks, requiring developers to write custom code to parse headers and apply results, adding initial setup complexity.
Separate documentation for different versions can confuse users when searching for specific examples or migration guidance, as noted in the README's version warnings.