Skip to content

Add Headers::qfactors() to implement content negotiation#115

Merged
thekid merged 4 commits intomasterfrom
feature/qvalues
May 26, 2024
Merged

Add Headers::qfactors() to implement content negotiation#115
thekid merged 4 commits intomasterfrom
feature/qvalues

Conversation

@thekid
Copy link
Copy Markdown
Member

@thekid thekid commented May 25, 2024

Example:

$preference= Headers::qfactors()->parse('deflate, gzip;q=1.0, *;q=0.5');
// ['deflate' => 1.0, 'gzip' => 1.0, '*' => 0.5]

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation

@thekid
Copy link
Copy Markdown
Member Author

thekid commented May 25, 2024

MDN writes:

The Accept-Encoding header defines the acceptable content encoding (supported compressions). The value is a q-factor list (e.g., br, gzip;q=0.8) that indicates the priority of the encoding values.

Should the method be named qfactors() or qualityfactors() instead?

@thekid thekid changed the title Add Headers::qvalues() to implement content negotiation Add Headers::qfactors() to implement content negotiation May 26, 2024
@thekid thekid merged commit 10249e3 into master May 26, 2024
@thekid thekid deleted the feature/qvalues branch May 26, 2024 15:00
@thekid
Copy link
Copy Markdown
Member Author

thekid commented Jun 10, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant