Skip to content

Commit

Permalink
Improve documentation with a motivation section
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Nov 16, 2024
1 parent 8cff8e4 commit 7933b3d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions docs/00-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ $field[1]->value()->toString(); // returns 'application/xhtml+xml'
$field[1]->parameterByKey(key: 'q', default: 1.0); // returns 1.0 if the parameter is not defined
```

## Motivation

While they are plenty of HTTP headers and trailers, they have historically come each with their own set of
rules and constraints when it came to parsing and serializing them. Trying to use the parsing logic of a cookie header
to parse an accept header will fail. The various parsing logics hinders HTTP headers and trailers usage, modernization
or security. The [Structured Field RFC](https://www.rfc-editor.org/rfc/rfc9651.html) aim at tackling those issues by
unifying HTTP headers and trailers parsing and serializing.

New HTTP headers or trailers (called HTTP fields) are encouraged to use the RFC algorithm, data and value types and
ongoing discussions are happening to [retrofit existing headers that do not match the RFC](https://httpwg.org/http-extensions/draft-ietf-httpbis-retrofit.html) into new
shapes that would be compatible with it.

## Foreword

> [!CAUTION]
Expand Down
2 changes: 1 addition & 1 deletion docs/04-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is the structure from which you will be able to access the actual field con

## Items value

The height (8) defined value types are all attached to an `Item` object where their value and
The eight (8) defined value types are all attached to an `Item` object where their value and
type are accessible using the following methods:

```php
Expand Down

0 comments on commit 7933b3d

Please sign in to comment.