PHPackages                             hetzner-cloud-php/client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. hetzner-cloud-php/client

ActiveLibrary[API Development](/categories/api)

hetzner-cloud-php/client
========================

A PHP client for the Hetzner Cloud API.

0.1.5(1y ago)24[5 PRs](https://github.com/hetzner-cloud-php/client/pulls)MITPHPPHP ^8.4CI passing

Since Jan 14Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/hetzner-cloud-php/client)[ Packagist](https://packagist.org/packages/hetzner-cloud-php/client)[ RSS](/packages/hetzner-cloud-php-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (22)Versions (13)Used By (0)

 [![logo](docs/public/hetzner_cloud_php_logo.png)](docs/public/hetzner_cloud_php_logo.png) [![packgist downloads](https://camo.githubusercontent.com/15053e744f793ca2c517578e02b0d7680429a8ae34340abfded76ef74baf0239/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6865747a6e65722d636c6f75642d7068702f636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/15053e744f793ca2c517578e02b0d7680429a8ae34340abfded76ef74baf0239/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6865747a6e65722d636c6f75642d7068702f636c69656e742e7376673f7374796c653d666c61742d737175617265) [![tests ci](https://camo.githubusercontent.com/cd6ce015ac1682021cf16ef2d1f03fdcab51bace2a4ea351979f345885835f75/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6865747a6e65722d636c6f75642d7068702f636c69656e742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/cd6ce015ac1682021cf16ef2d1f03fdcab51bace2a4ea351979f345885835f75/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6865747a6e65722d636c6f75642d7068702f636c69656e742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265) [![packgist downloads](https://camo.githubusercontent.com/9cda8ed01b38d3ed81b16d8dac6c00c73ca634eea6695d14c14dfc378c5e1ecc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6865747a6e65722d636c6f75642d7068702f636c69656e742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/9cda8ed01b38d3ed81b16d8dac6c00c73ca634eea6695d14c14dfc378c5e1ecc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6865747a6e65722d636c6f75642d7068702f636c69656e742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265) [![packgist downloads](https://camo.githubusercontent.com/fcdc700cc2d5a8f666f41f9b9a5a87cf8fc849bbf29089de665e62996dde7814/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6865747a6e65722d636c6f75642d7068702f636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/fcdc700cc2d5a8f666f41f9b9a5a87cf8fc849bbf29089de665e62996dde7814/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6865747a6e65722d636c6f75642d7068702f636c69656e742e7376673f7374796c653d666c61742d737175617265)

Hetzner Cloud PHP
-----------------

[](#hetzner-cloud-php)

A PHP client for the Hetzner Cloud API. The goal of this project is to provide an easy-to-use and framework agnostic PHP PHP client for projects and applications interacting with Hetzner Cloud. Some use cases might include:

- Getting metrics for all servers within a project
- Programmatically creating firewalls
- Searching for available datacenters

Table of Contents
-----------------

[](#table-of-contents)

- [Getting started](#getting-started)
- [Usage](#usage)
    - [Database](#database)
    - [Firewalls](#firewalls)
    - [Servers](#servers)

Getting started
---------------

[](#getting-started)

The client is available as a composer packager that can be installed in any project using composer:

```
composer require hetzner-cloud-php/client
```

Since the client is compatible with any PSR-18 HTTP client, any commonly used HTTP client can be used thanks to our dependency on `php-http/discovery`. Once both dependencies have been installed, you may start interaction with [Hetzner Cloud API](https://docs.hetzner.cloud/):

```
/** @var string $apiKey */
$apiKey = $_ENV['HETZNER_CLOUD_API_KEY'];
$client = HetznerCloud::client($apiKey);

// Create a server
$response = $createdServer = $client->servers()->createServer([
    'name' => 'test-server',
    'server_type' => 'cpx11',
    'image' => 'ubuntu-24.04',
]);

echo $response->server->name; // 'test-server'
```

For a comprehensive set of examples, take a look at the [examples](/examples) directory.

Usage
-----

[](#usage)

### Datacenters

[](#datacenters)

#### Get all datacenters

[](#get-all-datacenters)

Gets a list of available datacenters.

```
$response = $client->datacenters()->getDatacenters(sort: 'name:desc');

echo $response->datacenters // array
echo $response->meta // Meta::class
echo $response->toArray() // ['datacenter' => ['id' => 42, ...], 'meta' => [...]]
```

#### Get a datacenter

[](#get-a-datacenter)

Gets a single datacenter.

```
$response = $client->datacenters()->getDatacenter(42);

echo $response->datacenter // Datacenter::class
echo $response->toArray() // ['datacenter' => ['id' => 42, ...], 'error' => null]
```

### `Firewalls`

[](#firewalls)

#### Get a firewall

[](#get-a-firewall)

Retrieves a single firewall for a project.

```
$response = $client->firewalls()->getFirewall(1337);
$response->firewall; // Firewall::class
$response->toArray(); // ['firewall' => ['id => 1337', ...]]
```

#### Get firewalls

[](#get-firewalls)

Retrieves all firewalls for a project, with a few optional query parameters.

```
$response = $client->firewalls()->getFirewalls(name: 'coolify', labelSelector: 'foo');
$response->firewalls; // array

foreach ($response->firewalls as $firewall) {
    $firewall->id;
    $firewall->name;
    // ...
}

$response->toArray(); // ['firewalls' => [...], 'meta' => [...]]
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance69

Regular maintenance activity

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

6

Last Release

481d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb50011d6f8c359f21b7352e7e7aaa76847a6d909d625bd439bf6c4df9fcf4d0?d=identicon)[JoeyMckenzie](/maintainers/JoeyMckenzie)

---

Top Contributors

[![JoeyMckenzie](https://avatars.githubusercontent.com/u/16873254?v=4)](https://github.com/JoeyMckenzie "JoeyMckenzie (97 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

apiclienthetzner-cloudphpsdksdkcloudhetzner

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hetzner-cloud-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/hetzner-cloud-php-client/health.svg)](https://phpackages.com/packages/hetzner-cloud-php-client)
```

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

963.1M35](/packages/getbrevo-brevo-php)[mozex/anthropic-php

Anthropic PHP is a supercharged community-maintained PHP API client that allows you to interact with Anthropic API.

46365.1k13](/packages/mozex-anthropic-php)[deeplcom/deepl-php

Official DeepL API Client Library

2616.2M66](/packages/deeplcom-deepl-php)[swisnl/json-api-client

A PHP package for mapping remote JSON:API resources to Eloquent like models and collections.

211473.2k12](/packages/swisnl-json-api-client)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2322.9M248](/packages/open-telemetry-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
