Skip to content

Commit 7ee7ff7

Browse files
author
Luca Castelnuovo
authored
Merge pull request #3 from CubeQuence/update/replace_guzzle
2 parents 2fdae1d + c641530 commit 7ee7ff7

File tree

8 files changed

+239
-253
lines changed

8 files changed

+239
-253
lines changed

README.md

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,50 +14,9 @@ PHP8 HashiCorp Vault client
1414

1515
1. `composer require cubequence/vault`
1616

17-
## Demo Code
18-
```php
19-
<?php
17+
## Example
2018

21-
require './vendor/autoload.php';
22-
23-
// https://www.vaultproject.io/api-docs/auth
24-
// https://www.vaultproject.io/api-docs/secret
25-
26-
use CQ\Vault\Auth\Provider\AppRole;
27-
use CQ\Vault\Auth\Provider\Token;
28-
use CQ\Vault\Client;
29-
30-
try {
31-
$tokenProvider = new Token(token: 's.XXXXXXXXXXXX');
32-
$approleProvider = new AppRole(
33-
roleId: 'XXXXXX-XXXXXX-XXXXXX-XXXXXX',
34-
secretId: 'XXXXXX-XXXXXX-XXXXXX-XXXXXX'
35-
);
36-
37-
$client = new Client(
38-
authProvider: $tokenProvider,
39-
baseUri: 'http://127.0.0.1:8200',
40-
version: 'v1' // Optional variable
41-
);
42-
43-
$write = $client->write('/kv1/helloworld', [
44-
'foo' => 'bar',
45-
]);
46-
$read = $client->read('/kv1/helloworld');
47-
$keys = $client->keys('/kv1');
48-
$revoke = $client->revoke('/kv1/helloworld');
49-
} catch (\Throwable $th) {
50-
echo $th->getMessage();
51-
exit;
52-
}
53-
54-
echo json_encode([
55-
"write" => $write, // NoContent
56-
"read" => $read,
57-
"keys" => $keys,
58-
"revoke" => $revoke, // NoContent
59-
]);
60-
```
19+
Look at the `examples` folder
6120

6221
## Security Vulnerabilities
6322

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
],
1515
"require": {
1616
"php": ">=8.0.0",
17-
"guzzlehttp/guzzle": "^7.0"
17+
"cubequence/request": "^1.0"
1818
},
1919
"require-dev": {
2020
"nunomaduro/phpinsights": "dev-master",

0 commit comments

Comments
 (0)