Skip to content

Commit 66ec359

Browse files
committed
fix(docs): update badges and clean up examples
Signed-off-by: Benjamin Fahl <git@fahl-design.de>
1 parent ef4c651 commit 66ec359

1 file changed

Lines changed: 19 additions & 76 deletions

File tree

README.md

Lines changed: 19 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,49 @@
11
# PHP Docker API Client
22

3-
[![QA](https://github.com/WebProject-xyz/php-docker-api-client/actions/workflows/tests.yml/badge.svg)](https://github.com/WebProject-xyz/php-docker-api-client/actions/workflows/tests.yml)
4-
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/86f56d0d268d41e78c56658970e5b721)](https://www.codacy.com/gh/WebProject-xyz/php-docker-api-client/dashboard)
5-
[![Latest Stable Version](https://poser.pugx.org/webproject/php-docker-api-client/v/stable)](https://packagist.org/packages/webproject/php-docker-api-client)
6-
[![License](https://poser.pugx.org/webproject/php-docker-api-client/license)](https://packagist.org/packages/webproject/php-docker-api-client)
3+
[![Tests](https://github.com/WebProject-xyz/php-docker-api-client/actions/workflows/php-tests.yml/badge.svg)](https://github.com/WebProject-xyz/php-docker-api-client/actions/workflows/php-tests.yml)
4+
[![Release](https://github.com/WebProject-xyz/php-docker-api-client/actions/workflows/release.yml/badge.svg)](https://github.com/WebProject-xyz/php-docker-api-client/actions/workflows/release.yml)
5+
[![PHP Version](https://img.shields.io/packagist/php-v/webproject-xyz/docker-api-client)](https://packagist.org/packages/webproject-xyz/docker-api-client)
6+
[![Latest Stable Version](https://img.shields.io/packagist/v/webproject-xyz/docker-api-client)](https://packagist.org/packages/webproject-xyz/docker-api-client)
7+
[![Total Downloads](https://img.shields.io/packagist/dt/webproject-xyz/docker-api-client)](https://packagist.org/packages/webproject-xyz/docker-api-client)
8+
[![License](https://img.shields.io/packagist/l/webproject-xyz/docker-api-client)](https://packagist.org/packages/webproject-xyz/docker-api-client)
79

8-
A modern, high-level PHP client for the Docker Engine API, built on top of [JanePHP](https://github.com/janephp/janephp) and supporting the latest Docker API specs (v1.51+).
9-
10-
---
11-
12-
## 🚀 Features
13-
14-
- **High-level Service Layer**: Easy access to container information through the `DockerService`.
15-
- **Modern PHP**: Fully typed, leveraging PHP 8.3+ features.
16-
- **Auto-generated Models**: Powered by JanePHP based on official Docker OpenAPI specs.
17-
- **DTO Support**: Includes `DockerContainerDto` for easy data handling and URL extraction from environment variables.
18-
- **CLI Tool**: Built-in `bin/docker-api` for quick interactions.
19-
20-
---
21-
22-
## 📦 Installation
23-
24-
```bash
25-
composer require webproject/php-docker-api-client
26-
```
10+
A modern PHP client for the Docker Engine API (v1.51+), built with [JanePHP](https://github.com/janephp/janephp).
2711

2812
---
2913

3014
## 💻 Usage
3115

32-
### Initialize the Client
33-
16+
### Initialize Service
3417
```php
3518
use WebProject\DockerApiClient\Client\DockerApiClientWrapper;
3619
use WebProject\DockerApiClient\Service\DockerService;
3720

38-
// Create a client pointing to your local Docker socket
39-
$wrapper = DockerApiClientWrapper::create(
40-
uri: 'http://localhost',
41-
socketPath: '/var/run/docker.sock'
21+
$service = new DockerService(
22+
DockerApiClientWrapper::create('http://localhost', '/var/run/docker.sock')
4223
);
43-
44-
$dockerService = new DockerService($wrapper);
4524
```
4625

47-
### List and Inspect Containers
48-
26+
### Manage Containers
4927
```php
50-
// Get all containers (includes inspection data)
51-
$containers = $dockerService->findAllContainer();
52-
53-
foreach ($containers as $id => $container) {
54-
echo "Container ID: {$container->id}
55-
";
56-
echo "Name: {$container->getName()}
57-
";
58-
echo "Image: {$container->image}
59-
";
60-
echo "Running: " . ($container->running ? 'Yes' : 'No') . "
28+
// List and inspect containers
29+
foreach ($service->findAllContainer() as $container) {
30+
echo "{$container->getName()}: " . ($container->running ? 'Running' : 'Stopped') . "
6131
";
6232

63-
// Extract virtual hosts from env vars (e.g. for reverse proxies)
64-
$urls = $container->extractUrlsFromEnvVars(['VIRTUAL_HOST', 'DOMAIN_NAME']);
65-
print_r($urls);
33+
// Extract env-based URLs
34+
$urls = $container->extractUrlsFromEnvVars(['VIRTUAL_HOST']);
6635
}
6736
```
6837

69-
### Direct API Access
70-
71-
For low-level access to all Docker API endpoints, use the generated JanePHP client:
72-
73-
```php
74-
$client = $wrapper->getDockerClient();
75-
$info = $client->systemInfo();
76-
echo "Docker Server Version: " . $info->getServerVersion() . "
77-
";
78-
```
79-
80-
---
81-
82-
## 🛠 CLI Usage
83-
84-
The package includes a command-line interface for common tasks:
85-
38+
### CLI Support
8639
```bash
87-
# List all containers
8840
bin/docker-api docker:list-containers
89-
90-
# Listen for Docker socket events
91-
bin/docker-api docker:events:listen
9241
```
9342

9443
---
9544

96-
## 📖 Development
97-
98-
The underlying client is generated from the Docker API spec. See [UPDATE.md](spec/UPDATE.md) for details on how to update the generated classes when new Docker API versions are released.
99-
10045
## 🤝 Contributing
101-
102-
Contributions are welcome! Please feel free to submit a Pull Request.
46+
Pull Requests are welcome.
10347

10448
## 📄 License
105-
106-
This project is licensed under the MIT License.
49+
MIT License.

0 commit comments

Comments
 (0)