You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-5
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,58 @@
1
1
# A PHP package for seamless interaction with Kong Gateway's Admin API
2
2
3
-
[](https://packagist.org/packages/cleaniquecoders/kong-admin-api)
[](https://packagist.org/packages/cleaniquecoders/kong-admin-api)[](https://github.com/cleaniquecoders/kong-admin-api/actions/workflows/run-tests.yml)[](https://packagist.org/packages/cleaniquecoders/kong-admin-api)
6
4
7
5
## Installation
8
6
9
-
You can install the package via composer:
7
+
You can install the package via Composer:
10
8
11
9
```bash
12
10
composer require cleaniquecoders/kong-admin-api
13
11
```
14
12
15
13
## Usage
16
14
15
+
This package provides a simple and flexible way to interact with Kong Gateway's Admin API.
16
+
17
+
### Basic Setup
18
+
19
+
Instantiate the Kong Admin Client:
20
+
21
+
```php
22
+
use CleaniqueCoders\KongAdminApi\KongAdminClient;
23
+
24
+
$client = new KongAdminClient('http://localhost:8001'); // Replace with your Kong Admin URL
25
+
```
26
+
27
+
### Example: Creating a Service
28
+
29
+
```php
30
+
$response = $client->services()->create([
31
+
'name' => 'example-service',
32
+
'url' => 'http://example.com',
33
+
]);
34
+
35
+
if ($response->isSuccessful()) {
36
+
echo "Service created successfully!";
37
+
} else {
38
+
echo "Failed to create service: " . $response->getError();
39
+
}
40
+
```
41
+
42
+
### Available Methods
43
+
44
+
-**Services**: Manage and configure services.
45
+
-**Routes**: Define routes for services.
46
+
-**Consumers**: Manage consumers for your services.
47
+
-**Plugins**: Attach plugins to services, routes, or consumers.
48
+
-**Certificates**: Handle SSL certificates.
49
+
50
+
Please refer to the official Kong Gateway documentation for detailed options and parameters for each endpoint.
51
+
17
52
## Testing
18
53
54
+
To run tests:
55
+
19
56
```bash
20
57
composer test
21
58
```
@@ -26,7 +63,7 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re
26
63
27
64
## Contributing
28
65
29
-
Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.
66
+
Please see [CONTRIBUTING](https://github.com/cleaniquecoders/kong-admin-api/blob/main/CONTRIBUTING.md) for details on how to contribute.
0 commit comments