fyre/negotiate

A negotiation library.

v2.0.6 2024-06-29 01:55 UTC

This package is auto-updated.

Last update: 2024-06-29 01:56:07 UTC


README

FyreNegotiate

FyreNegotiate is a free, open-source negotiation library for PHP.

Table Of Contents

Installation

Using Composer

composer require fyre/negotiate

In PHP:

use Fyre\Http\Negotiate;

Methods

Content

Negotiate a content type.

  • $accepted is a string representing the Accept header.
  • $supported is an array containing the supported content values.
  • $strict is a boolean indicating whether to not use a default fallback, and will default to false.
Negotiate::content($accepted, $supported, $strict);

Encoding

Negotiate an encoding.

  • $accepted is a string representing the Accept-Encoding header.
  • $supported is an array containing the supported encoding values.
Negotiate::encoding($accepted, $supported);

Language

Negotiate a language.

  • $accepted is a string representing the Accept-Language header.
  • $supported is an array containing the supported language values.
Negotiate::language($accepted, $supported);