Skip to content

Commit

Permalink
Merge pull request #8 from programmatordev/1.x
Browse files Browse the repository at this point in the history
v1.0.1
  • Loading branch information
andrepimpao authored May 29, 2024
2 parents fbe1bb0 + b31515a commit 4a6d765
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
/vendor/
/logs/
/.idea
/index.php
/index.php
/src/TestApi.php
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ class YourApi extends Api

#### `addPreRequestListener`

The `addPreRequestListener` method is used to add a function that is called before a request, and all handled data, has been made.
The `addPreRequestListener` method is used to add a function that is called before a request has been made.
This event listener will be applied to every API request.

```php
Expand Down Expand Up @@ -673,8 +673,7 @@ The following list has all the implemented plugins with the respective priority
| [`LoggerPlugin`](https://docs.php-http.org/en/latest/plugins/logger.html) | 8 | only if logger is enabled |

For example, if you wanted the client to automatically attempt to re-send a request that failed
(due to unreliable connections and servers, for example)
you can add the [RetryPlugin](https://docs.php-http.org/en/latest/plugins/retry.html);
(due to unreliable connections and servers, for example) you can add the [RetryPlugin](https://docs.php-http.org/en/latest/plugins/retry.html):

```php
use ProgrammatorDev\Api\Api;
Expand All @@ -687,11 +686,11 @@ class YourApi extends Api
// ...

// if a request fails, it will retry at least 3 times
// priority is 12 to execute the plugin between the cache and logger plugins
// priority is 20 to execute before the cache plugin
// (check the above plugin order list for more information)
$this->getClientBuilder()->addPlugin(
plugin: new RetryPlugin(['retries' => 3])
priority: 12
plugin: new RetryPlugin(['retries' => 3]),
priority: 20
);
}
}
Expand Down Expand Up @@ -895,7 +894,7 @@ class YourApi extends Api
}
```

For the end user, it should look like this:
When using the API, it should look like this:

```php
$api = new YourApi([
Expand Down

0 comments on commit 4a6d765

Please sign in to comment.