Skip to content

Commit

Permalink
Initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLevti committed Dec 18, 2022
1 parent 7381c6d commit 291928a
Show file tree
Hide file tree
Showing 9 changed files with 5,220 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
max-parallel: 10
matrix:
php: ['8.0', '8.1', '8.2']
php: ['8.1', '8.2']
lowest: [' --prefer-lowest', '']
steps:
- name: Set up PHP
Expand Down
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ The format is based on [Keep a Changelog][1], and this project adheres to

## [Unreleased]

## [1.0.0] - 2022-11-05
## [1.0.0] - 2022-12-18

### Added

- Initial version of the `poor-plebs/package-template`.
- Initial version of the `poor-plebs/guzzle-connect-retry-decider`.

[1]: https://keepachangelog.com/en/1.1.0/
[2]: https://semver.org/spec/v2.0.0.html

[Unreleased]: https://github.com/Poor-Plebs/package-template/compare/1.0.0...HEAD
[1.0.0]: https://github.com/Poor-Plebs/package-template/releases/1.0.0
[Unreleased]: https://github.com/Poor-Plebs/guzzle-connect-retry-decider/compare/1.0.0...HEAD
[1.0.0]: https://github.com/Poor-Plebs/guzzle-connect-retry-decider/releases/1.0.0
53 changes: 39 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,67 @@
# poor-plebs/package-template
# poor-plebs/guzzle-connect-retry-decider

[![CI](https://github.com/Poor-Plebs/package-template/actions/workflows/ci.yml/badge.svg)](https://github.com/Poor-Plebs/package-template/actions/workflows/ci.yml)
[![CI](https://github.com/Poor-Plebs/guzzle-connect-retry-decider/actions/workflows/ci.yml/badge.svg)](https://github.com/Poor-Plebs/guzzle-connect-retry-decider/actions/workflows/ci.yml)

**[What is it for?](#what-is-it-for)** |
**[What are the requirements?](#what-are-the-requirements)** |
**[How to install it?](#how-to-install-it)** |
**[How to use it?](#how-to-use-it)** |
**[How to contribute?](#how-to-contribute)**

Put a short one or two sentence description of the package.
A guzzle retry middleware decider that re-attempts requests whenever a
connection fails to be established. Always retries up to x times for GET
requests and under specific conditions also for other HTTP methods.

## What is it for?

Explain in detail here what this package is for.
To be more resilient against all kind of connectivity issues, it is a good
practice to just simply retry the request. The guzzle http package already comes
with a generic retry middleware out of the box that accepts a decider callable.

## What are the requirements?
This package provides a decider that will re attempt a request up to x times
when ever a guzzle connect exception is thrown. For GET requests, the decider
will always retry. For other HTTP methods, the decider will only retry, when
no connection could be established yet (no data sent and for HTTPS no handshake
done) to prevent potential double send incidents.

Explain here what the runtime requirements are, which extensions need to be
installed.
## What are the requirements?

- PHP 8.0 or above
- PHP 8.1 or above

## How to install it?

Explain here how to install the package.

```bash
composer require poor-plebs/package-template
composer require poor-plebs/guzzle-connect-retry-decider
```

## How to use it?

Explain here how to use this package.
```php

use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;

$handlerStack = HandlerStack::create();

// Where to put this middleware in the middleware stack depends on your usecase.
// Usually just before the handler on top or before a log middleware.
$handlerStack->push(
Middleware::retry(new ConnectRetryDecider()),
'connect_retry',
);

$client = new Client([
'base_uri' => 'https://sometest.com/',
'handler' => $handlerStack,
]);

$client->getAsync('information')->wait();
```

## How to contribute?

`poor-plebs/package-template` follows semantic versioning. Read more on
[semver.org][1].
`poor-plebs/guzzle-connect-retry-decider` follows semantic versioning. Read more
on [semver.org][1].

Create issues to report problems or requests. Fork and create pull requests to
propose solutions and ideas. Always add a CHANGELOG.md entry in the unreleased
Expand Down
16 changes: 9 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "poor-plebs/package-template",
"description": "Put a short one or two sentence description of the package.",
"name": "poor-plebs/guzzle-connect-retry-decider",
"description": "A guzzle retry middleware decider that re-attempts requests whenever a connection fails to be established. Always retries up to x times for GET requests and under specific conditions also for other HTTP methods.",
"type": "library",
"license": "MIT",
"autoload": {
"psr-4": {
"PoorPlebs\\PackageTemplate\\": "src/"
"PoorPlebs\\GuzzleConnectRetryDecider\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"PoorPlebs\\PackageTemplate\\Tests\\": "tests/"
"PoorPlebs\\GuzzleConnectRetryDecider\\Tests\\": "tests/"
}
},
"authors": [
{
"name": "John Doe",
"email": "john.doe@example.com"
"name": "Petr Levtonov",
"email": "petr@levtonov.com"
}
],
"archive": {
Expand Down Expand Up @@ -49,7 +49,9 @@
"roave/security-advisories": "dev-latest"
},
"require": {
"php": "^8.0.0"
"php": "^8.1.0",
"guzzlehttp/guzzle": "^6.5.8 || ^7.4.5",
"psr/http-message": "^1.0.0"
},
"scripts": {
"all": [
Expand Down
Loading

0 comments on commit 291928a

Please sign in to comment.