Skip to content

Commit 5589fa0

Browse files
authored
PHP 8 and other things. (#45)
1 parent 7aaf046 commit 5589fa0

File tree

105 files changed

+932
-585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+932
-585
lines changed

.github/workflows/tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ on:
2222

2323
env:
2424
CONSUL_HTTP_ADDR: "127.0.0.1:8500"
25-
CONSUL_VERSION: '1.16.1'
25+
CONSUL_VERSION: '1.17.2'
2626

2727
jobs:
2828
tests:
2929
runs-on: ubuntu-22.04
3030
strategy:
3131
matrix:
32-
php-version: ["7.4", "8.0", "8.1", "8.2"]
32+
php-version: ["8.0", "8.1", "8.2"]
3333

3434
name: Tests - PHP ${{ matrix.php-version }}
3535
steps:

README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44

55
PHP client for the [Consul HTTP API](https://www.consul.io/docs/agent/http.html)
66

7-
This library is loosely based upon the [official GO client](https://github.com/hashicorp/consul/tree/master/api).
7+
This library is loosely based upon the [official GO client](https://github.com/hashicorp/consul/tree/main/api).
88

99
## Version Compatibility
1010

11-
|PHPConsulAPI Version|Consul Version|
12-
|---|---|
13-
|0.3.x|0.6.4|
14-
|0.6.x|0.7-0.8|
15-
|v1.x|0.9-current|
16-
|dev-master|current|
11+
| PHPConsulAPI Version | Consul Version |
12+
|----------------------|----------------|
13+
| 0.3.x | 0.6.4 |
14+
| 0.6.x | 0.7-0.8 |
15+
| v1.x | 0.9-current |
16+
| v2.x | 0.9-current |
17+
| dev-master | current |
1718

1819
Newer versions of the api lib will probably work in a limited capacity with older versions of Consul, but no guarantee
1920
is made and backwards compatibility issues will not be addressed.
@@ -27,16 +28,16 @@ Require Entry:
2728
```json
2829
{
2930
"require": {
30-
"dcarbone/php-consul-api": "^v1.0"
31+
"dcarbone/php-consul-api": "^v2.0"
3132
}
3233
}
3334
```
3435

3536
## Configuration
3637

3738
First, construct a [Config](./src/Config.php). This class is modeled quite closely after the
38-
[Config Struct](https://github.com/hashicorp/consul/blob/v1.9.3/api/api.go#L280) present in the
39-
[Consul API Subpackage](https://github.com/hashicorp/consul/blob/v1.9.3/api).
39+
[Config Struct](https://github.com/hashicorp/consul/blob/7736539db5305d267b2fd4faa6e86590ca20e556/api/api.go#L339) present in the
40+
[Consul API Subpackage](https://github.com/hashicorp/consul/tree/v1.17.2/api).
4041

4142
### Default Configuration
4243

@@ -73,7 +74,7 @@ $config = new \DCarbone\PHPConsulAPI\Config([
7374
#### Configuration Note:
7475

7576
By default, this client will attempt to locate a series of environment variables to describe much of the above
76-
configuration properties. See [here](./src/Config.php#L559) for that list, and see [here](./src/Consul.php#L40) for
77+
configuration properties. See [here](./src/Config.php) for that list, and see [here](./src/Consul.php) for
7778
a list of the env var names.
7879

7980
For more advanced client configuration, such as proxy configuration, you must construct your own GuzzleHttp client
@@ -100,15 +101,16 @@ Next, construct a [Consul](./src/Consul.php) object:
100101
$consul = new \DCarbone\PHPConsulAPI\Consul($config);
101102
```
102103

103-
*NOTE*: If you do not create your own config object, [Consul](./src/Consul.php#L171) will create it's own
104-
using [Config::newDefaultConfig()](./src/Config.php#L253) and attempt to locate a suitable HTTP Client.
104+
*NOTE*: If you do not create your own config object, [Consul](./src/Consul.php) will create it's own
105+
using [Config::newDefaultConfig()](./src/Config.php) and attempt to locate a suitable HTTP Client.
105106

106107
Once constructed, you interact with each Consul API via it's corresponding Client class:
107108

108109
```php
109110
$kvResp = $consul->KV->Keys();
110-
if (null !== $kvResp->Err)
111+
if (null !== $kvResp->Err) {
111112
die($kvResp->Err);
113+
}
112114

113115
var_dump($kvResp->Value);
114116
```

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"php-consul-api"
1717
],
1818
"require": {
19-
"php": "7.4.* || 8.*",
19+
"php": "8.*",
2020
"ext-json": "*",
21-
"dcarbone/gotime": "v0.4.* || v0.5.*",
21+
"dcarbone/gotime": "v0.5.*",
2222
"dcarbone/gohttp": "v0.3.*",
2323
"guzzlehttp/guzzle": "^7.4",
2424
"guzzlehttp/psr7": "^2.4"

0 commit comments

Comments
 (0)