Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dcarbone/php-consul-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.7
Choose a base ref
...
head repository: dcarbone/php-consul-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.0.0
Choose a head ref
  • 1 commit
  • 105 files changed
  • 1 contributor

Commits on Feb 11, 2024

  1. Copy the full SHA
    5589fa0 View commit details
Showing with 932 additions and 585 deletions.
  1. +2 −2 .github/workflows/tests.yaml
  2. +16 −14 README.md
  3. +2 −2 composer.json
  4. +288 −273 composer.lock
  5. +22 −2 src/ACL/ACLAuthMethod.php
  6. +1 −1 src/ACL/ACLAuthMethodListEntryQueryResponse.php
  7. +1 −1 src/ACL/ACLAuthMethodQueryResponse.php
  8. +1 −1 src/ACL/ACLAuthMethodWriteResponse.php
  9. +1 −1 src/ACL/ACLBindingRuleQueryResponse.php
  10. +1 −1 src/ACL/ACLBindingRuleWriteResponse.php
  11. +1 −1 src/ACL/ACLBindingRulesQueryResponse.php
  12. +1 −1 src/ACL/ACLEntriesResponse.php
  13. +1 −1 src/ACL/ACLLoginParams.php
  14. +1 −1 src/ACL/ACLOIDCAuthURLParams.php
  15. +1 −1 src/ACL/ACLPolicyListEntryQueryResponse.php
  16. +1 −1 src/ACL/ACLPolicyQueryResponse.php
  17. +1 −1 src/ACL/ACLPolicyWriteResponse.php
  18. +1 −1 src/ACL/ACLReplicationStatusResponse.php
  19. +1 −1 src/ACL/ACLRoleQueryResponse.php
  20. +1 −1 src/ACL/ACLRoleWriteResponse.php
  21. +1 −1 src/ACL/ACLRolesQueryResponse.php
  22. +1 −1 src/ACL/ACLTokenListEntryQueryResponse.php
  23. +1 −1 src/ACL/ACLTokenQueryResponse.php
  24. +1 −1 src/ACL/ACLTokenWriteResponse.php
  25. +8 −8 src/AbstractClient.php
  26. +5 −2 src/AbstractModel.php
  27. +3 −3 src/AbstractResponse.php
  28. +2 −3 src/AbstractValuedQueryResponse.php
  29. +2 −3 src/AbstractValuedResponse.php
  30. +2 −3 src/AbstractValuedWriteResponse.php
  31. +1 −1 src/Agent/AgentCheck.php
  32. +1 −1 src/Agent/AgentChecksResponse.php
  33. +12 −28 src/Agent/AgentClient.php
  34. +3 −3 src/Agent/AgentHealthServiceResponse.php
  35. +2 −2 src/Agent/AgentHealthServicesResponse.php
  36. +6 −10 src/Agent/AgentMember.php
  37. +2 −2 src/Agent/AgentMembersResponse.php
  38. +119 −5 src/Agent/AgentServiceConnectProxyConfig.php
  39. +2 −2 src/Agent/AgentServiceResponse.php
  40. +2 −2 src/Agent/AgentServicesResponse.php
  41. +143 −0 src/Agent/EnvoyExtension.php
  42. +2 −2 src/Agent/MetricsInfoResponse.php
  43. +49 −0 src/Agent/TransparentProxyConfig.php
  44. +2 −2 src/Catalog/CatalogNodeResponse.php
  45. +2 −2 src/Catalog/CatalogNodeServicesListResponse.php
  46. +2 −2 src/Catalog/CatalogServicesResponse.php
  47. +2 −2 src/Catalog/GatewayServicesResponse.php
  48. +2 −2 src/Catalog/NodesResponse.php
  49. +2 −2 src/Config.php
  50. +1 −1 src/ConfigEntry/ConfigEntryTrait.php
  51. +1 −1 src/ConfigEntry/ProxyConfigEntry.php
  52. +2 −2 src/ConfigEntry/ServiceRouteHTTPMatchHeader.php
  53. +4 −0 src/Consul.php
  54. +1 −1 src/Coordinate/Coordinate.php
  55. +2 −2 src/Coordinate/CoordinateDatacentersResponse.php
  56. +2 −2 src/Coordinate/CoordinateEntriesResponse.php
  57. +1 −1 src/Coordinate/DimensionalityConflictException.php
  58. +1 −1 src/Coordinate/funcs.php
  59. +3 −3 src/DecodedBody.php
  60. +1 −1 src/Event/EventClient.php
  61. +2 −2 src/Event/UserEventResponse.php
  62. +2 −2 src/Event/UserEventsResponse.php
  63. +16 −16 src/FakeMap.php
  64. +8 −13 src/FakeSlice.php
  65. +2 −2 src/HasSettableStringTags.php
  66. +2 −2 src/Health/HealthChecksResponse.php
  67. +7 −11 src/Health/HealthClient.php
  68. +2 −2 src/Health/ServiceEntriesResponse.php
  69. +5 −5 src/KV/KVClient.php
  70. +1 −1 src/KV/KVPairResponse.php
  71. +2 −2 src/KV/KVPairsResponse.php
  72. +13 −13 src/KV/KVTree.php
  73. +2 −2 src/MapResponse.php
  74. +10 −20 src/Marshaller.php
  75. +1 −1 src/Operator/AutopilotServer.php
  76. +2 −2 src/Operator/AutopilotStateResponse.php
  77. +2 −2 src/Operator/OperatorAreaJoinResponse.php
  78. +2 −2 src/Operator/OperatorAreasResponse.php
  79. +2 −2 src/Operator/OperatorAutopilotConfigurationResponse.php
  80. +3 −2 src/Operator/OperatorClient.php
  81. +2 −2 src/Operator/OperatorHealthReplyResponse.php
  82. +2 −2 src/Operator/OperatorRaftConfigurationResponse.php
  83. +2 −2 src/Operator/OperatorSerfMembersResponse.php
  84. +2 −2 src/Operator/OperatorServerHealthsResponse.php
  85. +1 −1 src/Operator/ReadableDuration.php
  86. +1 −1 src/PreparedQuery/PreparedQueryDefinitionsResponse.php
  87. +1 −1 src/PreparedQuery/PreparedQueryExecuteResponseResponse.php
  88. +1 −1 src/PreparedQuery/QueryDNSOptions.php
  89. +8 −8 src/QueryOptions.php
  90. +3 −3 src/Request.php
  91. +1 −1 src/ResponseValueBoolTrait.php
  92. +1 −1 src/ResponseValueStringTrait.php
  93. +1 −1 src/ResponseValueStringsTrait.php
  94. +2 −1 src/Session/SessionClient.php
  95. +1 −1 src/Session/SessionEntriesQueryResponse.php
  96. +1 −1 src/Session/SessionEntriesWriteResponse.php
  97. +4 −4 src/Transcoding.php
  98. +1 −1 src/UnmarshalledResponseInterface.php
  99. +9 −9 src/Unmarshaller.php
  100. +1 −1 src/ValuedResponseInterface.php
  101. +1 −1 src/Values.php
  102. +3 −3 src/WriteOptions.php
  103. +3 −4 src/WriteResponse.php
  104. +0 −10 src/funcs.php
  105. +48 −0 tests/Usage/Agent/AgentServiceConnectProxyConfigTest.php
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -22,14 +22,14 @@ on:

env:
CONSUL_HTTP_ADDR: "127.0.0.1:8500"
CONSUL_VERSION: '1.16.1'
CONSUL_VERSION: '1.17.2'

jobs:
tests:
runs-on: ubuntu-22.04
strategy:
matrix:
php-version: ["7.4", "8.0", "8.1", "8.2"]
php-version: ["8.0", "8.1", "8.2"]

name: Tests - PHP ${{ matrix.php-version }}
steps:
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,16 +4,17 @@

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

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

## Version Compatibility

|PHPConsulAPI Version|Consul Version|
|---|---|
|0.3.x|0.6.4|
|0.6.x|0.7-0.8|
|v1.x|0.9-current|
|dev-master|current|
| PHPConsulAPI Version | Consul Version |
|----------------------|----------------|
| 0.3.x | 0.6.4 |
| 0.6.x | 0.7-0.8 |
| v1.x | 0.9-current |
| v2.x | 0.9-current |
| dev-master | current |

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

## Configuration

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

### Default Configuration

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

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

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:
$consul = new \DCarbone\PHPConsulAPI\Consul($config);
```

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

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

```php
$kvResp = $consul->KV->Keys();
if (null !== $kvResp->Err)
if (null !== $kvResp->Err) {
die($kvResp->Err);
}

var_dump($kvResp->Value);
```
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -16,9 +16,9 @@
"php-consul-api"
],
"require": {
"php": "7.4.* || 8.*",
"php": "8.*",
"ext-json": "*",
"dcarbone/gotime": "v0.4.* || v0.5.*",
"dcarbone/gotime": "v0.5.*",
"dcarbone/gohttp": "v0.3.*",
"guzzlehttp/guzzle": "^7.4",
"guzzlehttp/psr7": "^2.4"
Loading