Skip to content

Commit 0e6b415

Browse files
committed
Improve documentation layout
1 parent b939cf4 commit 0e6b415

14 files changed

+55
-110
lines changed

docs/2.0/field-values.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ Item::true(): self;
164164
Item::false(): self;
165165
```
166166

167-
On error, those named constructor will throw an exception, if you do not want an exception
168-
and prefer a softer approache where the named constructor would instead return `null`, you
169-
can prepend the named constructor with the `try` prefix.
167+
On error, the listed named constructors will throw an exception, if you do not want an exception
168+
and prefer a softer approach where the named constructor would instead return `null`, you
169+
can prepend the listed named constructor with the `try` prefix.
170170

171171
```php
172172
Item::fromDecimal('42'); // will throw because the value is a string;

docs/2.0/rfc-usage.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ title: RFC Usage
55

66
# RFC Usage
77

8+
The IETF RFC defines two algorithms regarding HTTP headers and trailers, one to parse them and
9+
another one to serialize them.
10+
811
## Parsing a field
912

10-
The first way to use the package is to enable HTTP header or HTTP trailer parsing. We will refer to them
11-
as HTTP fields for the rest of the documentation as it is how they are named in the IETF RFC.
13+
The package enabled HTTP header or HTTP trailer parsing. We will refer to them as HTTP fields
14+
for the rest of the documentation as it is how they are named in the IETF RFC.
1215

1316
Let's say we want to parse the [Permissions-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#syntax) field. The first thing to know
1417
is that each structured field is defined against one specific data type which is
@@ -32,7 +35,7 @@ using the container public API:
3235
$permissions['picture-in-picture']->isEmpty(); // returns true because the list is empty
3336
count($permissions['geolocation']); // returns 2 the 'geolocation' feature has 2 values associated to it via a list
3437
$permissions['geolocation'][-1]->value(); // returns the last value of the list 'https://example.com/'
35-
$permissions['camera']->value(); // returns '*' the sole value attached to the 'camera' feature
38+
$permissions['camera']->value()->toString(); // returns '*' the sole value attached to the 'camera' feature
3639
isset($permissions['yolo']); // returns false this permission does not exust
3740
$permissions->isEmpty(); // returns false the dictionary contains some permissions
3841
echo $permissions; // returns 'picture-in-picture=(), geolocation=(self "https://example.com/"), camera=*'
@@ -42,8 +45,8 @@ echo $permissions; // returns 'picture-in-picture=()
4245

4346
## Serializing a field
4447

45-
Conversely, if you need to quickly create a permission policy HTTP field text representation, the package
46-
provides the following ways to do by strictly following the RFC:
48+
Conversely, if you need to quickly create and serialize a permission policy HTTP field text representation, the package
49+
provides a serializer mechanism which strictly follow the RFC:
4750

4851
```php
4952
echo DataType::Dictionary->serialize([
@@ -54,14 +57,12 @@ echo DataType::Dictionary->serialize([
5457
// returns picture-in-picture=(), geolocation=(self "https://example.com/"), camera=*
5558
```
5659

57-
Again, we start from the knowledge that the field is a `Dictionary`, content is added using
58-
pairs to respect value position. As such we can turn the iterable construct we have into a
59-
proper HTTP field text representation by applying the serialization mechanism described in
60-
the RFC.
61-
62-
While field building may look overwhelming, at first, it follows the fully described and tested
63-
process from the RFC. The package exposes numerous methods to simplify this process for you.
60+
Again, we start from the knowledge that the field is a `Dictionary`. The content is added
61+
using lists or ordered map represented as collection of pairs to respect value position.
62+
As such we can turn the iterable construct we have into a proper HTTP field text representation
63+
by applying the serialization mechanism described in the RFC.
6464

65-
The goal of the examples are to show that even without dwelling too much into the ins and out
66-
of the package you can easily and quickly parse or serialize compliant fields in PHP base solely
67-
on the RFC.
65+
Because field building may look overwhelming, at first, the package exposes numerous methods to
66+
simplify this process for you. But nevertheless it is important to understand that even without
67+
dwelling too much into the ins and out of the package you can easily and quickly parse or
68+
serialize compliant fields in PHP base solely on the RFC information.

docs/_layouts/default.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<meta http-equiv="X-UA-Compatible" content="IE=edge">
1313
<meta name="viewport" content="width=device-width, initial-scale=1">
1414
<meta name="description" content="{{ site.data.project.description }}">
15-
<meta name="docsearch:version" content="{{ version }}">
15+
<link rel="icon" href="{{ site.baseurl }}/assets/img/httpsf-logo.svg" type="image/svg+xml">
1616
<title>{{ page.title }} - {{ site.data.project.title }}</title>
1717
<link rel="apple-touch-icon-precomposed" href="//theme.thephpleague.com/img/apple-touch-icon-precomposed.png">
1818
<link rel="preconnect" href="https://fonts.googleapis.com">
@@ -25,6 +25,7 @@
2525
<header class="flex items-center sm:justify-center pl-6 pr-6 pb-6 max-w-7xl mx-auto pb-32">
2626
<div class="flex gap-6 md:gap-0 md:flex-row justify-between md:items-center p-3 md:p-6 w-full max-w-7xl">
2727
<a class="flex items-center gap-2 sm:gap-3" href="{{ site.baseurl }}/">
28+
<img src="{{ site.baseurl }}/assets/img/httpsf-logo.svg" alt="Logo" class="w-[40px] sm:w-[50px] h-[40px] sm:h-[50px]"/>
2829
<div class="font-black">HTTP Structured Fields</div>
2930
</a>
3031
</div>
@@ -82,6 +83,9 @@ <h3 class="font-semibold tracking-tight text-slate-900">Older versions</h3>
8283
<article class="content">
8384
{{ content }}
8485
</article>
86+
<div class="flex justify-center items-center">
87+
<img src="{{ site.baseurl }}/assets/img/httpsf.svg" alt="Logo" class="w-[240px] sm:w-[250px] h-[80px] sm:h-[82px]"/>
88+
</div>
8589
</div>
8690
</main>
8791
<footer class="p-6 max-w-7xl mx-auto pb-32">

docs/_layouts/homepage.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<meta name="description" content="{{ site.data.project.description }}">
7-
<meta name="docsearch:version" content="4.0">
7+
<link rel="icon" href="{{ site.baseurl }}/assets/img/httpsf-logo.svg" type="image/svg+xml">
88
<title>{{ site.data.project.tagline }} - {{ site.data.project.title }}</title>
99
<link rel="preconnect" href="https://fonts.googleapis.com">
1010
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -15,7 +15,10 @@
1515
<div class="relative z-10">
1616
<header class="flex items-center sm:justify-center">
1717
<div class="flex gap-6 md:gap-0 md:flex-row justify-between md:items-center p-3 md:p-6 w-full max-w-7xl">
18-
<div class="flex items-center gap-2 sm:gap-3"></div>
18+
<div class="flex items-center gap-2 sm:gap-3">
19+
<img src="{{ site.baseurl }}/assets/img/httpsf-logo.svg" alt="Logo" class="w-[40px] sm:w-[50px] h-[40px] sm:h-[50px]"/>
20+
<div class="font-black text-2xl">HTTP Structured Fields</div>
21+
</div>
1922
<div class="flex items-center gap-0 md:gap-0">
2023
<a href="{{ site.data.project.repository_url }}" class="px-2 py-2 sm:px-6 sm:py-3 font-black text-md text-black-50 hover:text-csv-dark hover:underlines whitespace-nowrap">SOURCE CODE</a>
2124
<a href="{{ site.baseurl }}/{{ site.data.project.release_major }}/" class="px-2 py-2 sm:px-6 sm:py-3 text-md text-white bg-csv-base hover:bg-csv-dark transition-all whitespace-nowrap rounded">Documentation</a>
@@ -48,6 +51,9 @@ <h2 class="font-medium text-3xl text-light">Work with HTTP Structured Fields in
4851
<div class="flex flex-col gap-3 my-16 content">
4952
{{ content }}
5053
</div>
54+
<div class="flex justify-center items-center">
55+
<img src="{{ site.baseurl }}/assets/img/httpsf.svg" alt="Logo" class="w-[240px] sm:w-[250px] h-[80px] sm:h-[82px]"/>
56+
</div>
5157
</div>
5258
</main>
5359

docs/_layouts/redirect.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
7-
<meta name="docsearch:version" content="4.0">
87
<meta name="description" content="{{ site.data.project.description }}">
8+
<link rel="icon" href="{{ site.baseurl }}/assets/img/httpsf-logo.svg" type="image/svg+xml">
9+
<title>{{ page.title }} - {{ site.data.project.title }}</title>
910
<meta http-equiv="refresh" content="0; url={{ page.redirect.to }}">
1011
<title>{{ site.data.project.tagline }} - {{ site.data.project.title }}</title>
1112
<link rel="stylesheet"href="{{ site.baseurl }}{{ site.data.manifest['docs.css'] }}">
@@ -34,6 +35,9 @@ <h1>Redirecting…</h1>
3435
<article class="content">
3536
{{ content }}
3637
</article>
38+
<div class="flex justify-center items-center">
39+
<img src="{{ site.baseurl }}/assets/img/httpsf.svg" alt="Logo" class="w-[240px] sm:w-[250px] h-[80px] sm:h-[82px]"/>
40+
</div>
3741
</div>
3842
</main>
3943
<footer class="p-6 max-w-7xl mx-auto pb-32">

docs/assets/img/csv-logo-big.svg

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/assets/img/csv-logo.svg

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/assets/img/github-logo.svg

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/assets/img/httpsf-logo.svg

Lines changed: 9 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)