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
-[`Wsse`](https://docs.php-http.org/en/latest/message/authentication.html#id2) Username and password
323
-
-[`QueryParam`](https://docs.php-http.org/en/latest/message/authentication.html#query-params) Array of query parameter values
324
-
-[`Header`](https://docs.php-http.org/en/latest/message/authentication.html#header) Header name and value
325
-
-[`Chain`](https://docs.php-http.org/en/latest/message/authentication.html#chain) Array of authentication instances
326
-
-`RequestConditional` A request matcher and authentication instances
316
+
Check all available authentication methods in the [PHP HTTP documentation](https://docs.php-http.org/en/latest/message/authentication.html#authentication-methods).
327
317
328
318
You can also [implement your own](https://docs.php-http.org/en/latest/message/authentication.html#implement-your-own) authentication method.
329
319
330
-
For example, if you have an API that is authenticated with a query parameter:
320
+
For example, if you have an API authenticated with a query parameter:
331
321
332
322
```php
333
323
use ProgrammatorDev\Api\Api;
@@ -367,7 +357,7 @@ class YourApi extends Api
367
357
368
358
#### `addPreRequestListener`
369
359
370
-
The `addPreRequestListener` method is used to add a function that is called before a request has been made.
360
+
The `addPreRequestListener` method is used to add a function called before a request has been made.
371
361
This event listener will be applied to every API request.
The `addResponseContentsListener` method is used to manipulate the response that was received from the API.
461
+
The `addResponseContentsListener` method is used to manipulate the response received from the API.
472
462
This event listener will be applied to every API request.
473
463
474
464
```php
@@ -648,7 +638,7 @@ class YourApi extends Api
648
638
This library enables attaching plugins to the HTTP client.
649
639
A plugin modifies the behavior of the client by intercepting the request and response flow.
650
640
651
-
Since plugin order matters, a plugin is added with a priority level, and are executed in descending order from highest to lowest.
641
+
Since plugin order matters, a plugin is added with a priority level and is executed in descending order from highest to lowest.
652
642
653
643
Check all the [available plugins](https://docs.php-http.org/en/latest/plugins/index.html) or [create your own](https://docs.php-http.org/en/latest/plugins/build-your-own.html).
654
644
@@ -673,7 +663,7 @@ The following list has all the implemented plugins with the respective priority
673
663
|[`LoggerPlugin`](https://docs.php-http.org/en/latest/plugins/logger.html)| 8 | only if logger is enabled |
674
664
675
665
For example, if you wanted the client to automatically attempt to re-send a request that failed
676
-
(due to unreliable connections and servers, for example) you can add the [RetryPlugin](https://docs.php-http.org/en/latest/plugins/retry.html):
666
+
(due to unreliable connections and servers, for example), you can add the [RetryPlugin](https://docs.php-http.org/en/latest/plugins/retry.html):
677
667
678
668
```php
679
669
use ProgrammatorDev\Api\Api;
@@ -686,7 +676,7 @@ class YourApi extends Api
686
676
// ...
687
677
688
678
// if a request fails, it will retry at least 3 times
689
-
// priority is 20 to execute before the cache plugin
679
+
// the priority is 20 to execute before the cache plugin
690
680
// (check the above plugin order list for more information)
691
681
$this->getClientBuilder()->addPlugin(
692
682
plugin: new RetryPlugin(['retries' => 3]),
@@ -709,12 +699,11 @@ use Psr\Cache\CacheItemPoolInterface;
709
699
new CacheBuilder(
710
700
// a PSR-6 cache adapter
711
701
CacheItemPoolInterface $pool,
712
-
// default lifetime (in seconds) of cache items
702
+
// default lifetime (in seconds) of cached items
713
703
?int $ttl = 60,
714
704
// An array of HTTP methods for which caching should be applied
715
705
$methods = ['GET', 'HEAD'],
716
-
// An array of cache directives to be compared with the headers of the HTTP response,
717
-
// in order to determine cacheability
706
+
// An array of cache directives to be compared with the headers of the HTTP response to determine cacheability
718
707
$responseCacheDirectives = ['max-age']
719
708
);
720
709
```
@@ -854,7 +843,7 @@ class YourApi extends Api
854
843
855
844
private function configureOptions(array $options): array
0 commit comments