HTTP Content Negotiation

Learn how to create a new Inphinit project.

Create routes

{placeholder}

Constant Description
Negotiation::ALL {placeholder}
Negotiation::HIGH {placeholder}
Negotiation::LOW {placeholder}

Accept

Get the first document type (Accept header) with the greatest q-factor.

$negotiation->accept() is equivalent to $negotiation->getAccept(Negotiation::HIGH)

Charset

Get the first charset with with the greatest q-factor.

$negotiation->acceptCharset() is equivalent to $negotiation->getCharset(Negotiation::HIGH)

Encoding

Get the first encoding with with the greatest q-factor.

$negotiation->acceptEncoding() is equivalent to $negotiation->getEncoding(Negotiation::HIGH)

Language

Get the first language with with the greatest q-factor.

$negotiation->acceptLanguage() is equivalent to $negotiation->getLanguage(Negotiation::HIGH)

Other headers

$negotiation->header('accept-foo', Negotiation::HIGH); TE: trailers, deflate;q=0.5

Q-Factor

Negotiation::qFactor($value, $sort = self::HIGH)

Go to homepage
Star us on Github