You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/usage.md
+14-2
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,18 @@
1
1
# Usage
2
2
3
-
## Supported Relations
3
+
## Primary Usage
4
+
5
+
The `BabDev\ServerPushManager\Contracts\PushManager::link()` method is the main method for adding a link with any set of relations and/or attributes which will be converted into an appropriate HTTP/2 `Link` response header value.
6
+
7
+
The method accepts three parameters:
8
+
9
+
-`$uri` - The URI for the resource
10
+
-`$rel` - The relations for this resource, this may be either a single string or an array of strings to specify multiple relations
11
+
-`$attributes` - An optional array of additional attributes for the resource, these are passed to the `Psr\Link\EvolvableLinkInterface::withAttribute()` method and the values should follow the specification's requirements
12
+
13
+
Note that this method returns the `$uri` passed into it, this allows you to wrap other function calls within calls to the manager (see below for an example).
14
+
15
+
## Helper Methods
4
16
5
17
The `BabDev\ServerPushManager\Contracts\PushManager` interface defines several helper methods for adding resources to a HTTP/2 `Link` response header with the appropriate relations, including:
6
18
@@ -13,7 +25,7 @@ The `BabDev\ServerPushManager\Contracts\PushManager` interface defines several h
13
25
Each of these methods accepts two parameters:
14
26
15
27
-`$uri` - The URI for the resource
16
-
-`$attributes` - An optional array of additional attributes for the resource
28
+
-`$attributes` - An optional array of additional attributes for the resource, these are passed to the `Psr\Link\EvolvableLinkInterface::withAttribute()` method and the values should follow the specification's requirements
17
29
18
30
Note that each of these methods returns the `$uri` passed into the method, this allows you to wrap other function calls within calls to the manager (see below for an example).
0 commit comments