Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 17, 2024 via composer

willdurand/negotiation 3.1.0

Content Negotiation tools for PHP provided as a standalone library.
Package summary
Share
0
issues
1
license
1
MIT
Package created
18 Jan 2013
Version published
30 Jan 2022
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
willdurand/negotiation@3.1.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of willdurand/negotiation 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does willdurand/negotiation do?

The willdurand/negotiation is a standalone PHP library that provides tools for content negotiation in your application regardless of the framework used. The functionality of this library is based on the specifications detailed in RFC 7231. The library is compatibility-tested extensively, ensuring high-quality, reliable results. It is excellent for implementing content negotiation features in your application with no dependencies on other libraries.

How do you use willdurand/negotiation?

To use the willdurand/negotiation library, you should first install it via the Composer package manager using the command: composer require willdurand/negotiation. Once the library is installed successfully, you can import and use it in your PHP code. Below are some examples of how to use the willdurand/negotiation library:

1. Media Type Negotiation:

$negotiator = new \Negotiation\Negotiator();
$acceptHeader = 'text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8';
$priorities = array('text/html; charset=UTF-8', 'application/json', 'application/xml;q=0.5');
$mediaType = $negotiator->getBest($acceptHeader, $priorities);
$value = $mediaType->getValue(); // 'text/html; charset=UTF-8'

2. Language Negotiation:

$negotiator = new \Negotiation\LanguageNegotiator();
$acceptLanguageHeader = 'en; q=0.1, fr; q=0.4, fu; q=0.9, de; q=0.2';
$priorities = array('de', 'fu', 'en');
$bestLanguage = $negotiator->getBest($acceptLanguageHeader, $priorities);
$type = $bestLanguage->getType(); // 'fu'

3. Encoding, Charset Negotiation:

The library also features EncodingNegotiator and CharsetNegotiator for negotiation of encoding and charsets, respectively.

Where are the willdurand/negotiation docs?

The documentation for the willdurand/negotiation library is available on the official GitHub repository at https://github.com/willdurand/Negotiation.git. The README file includes a complete overview of the library, installation instructions, usage examples, and contributory guidelines. The documentation for versions 1.x and 2.x can be accessed via links provided in the README. It's important to consult the appropriate version of the documentation when integrating the library into your project.