PHPackages                             cedricziel/php-hetzner-cloud-api - 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. cedricziel/php-hetzner-cloud-api

ActiveLibrary[API Development](/categories/api)

cedricziel/php-hetzner-cloud-api
================================

Hetzner Cloud API Client for PHP

v0.1.0(8y ago)56895[1 issues](https://github.com/cedricziel/php-hetzner-cloud-api/issues)MITPHPPHP ^7.0

Since Apr 18Pushed 8y ago2 watchersCompare

[ Source](https://github.com/cedricziel/php-hetzner-cloud-api)[ Packagist](https://packagist.org/packages/cedricziel/php-hetzner-cloud-api)[ RSS](/packages/cedricziel-php-hetzner-cloud-api/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

Hetzner Cloud API for PHP
=========================

[](#hetzner-cloud-api-for-php)

A API client library for the Hetzner Cloud APIs.

API keys can be obtained through the project settings.

Installation
------------

[](#installation)

```
composer require cedricziel/php-hetzner-cloud-api
```

Configuration and Basic Usage
-----------------------------

[](#configuration-and-basic-usage)

```
$token = '...';

// create an api client
$client = new \CedricZiel\HetznerCloudAPI\Client();

// set the credentials on your client
$client->authenticate($token);

// retrieve a list of servers
$client->servers->all();
```

Available clients
-----------------

[](#available-clients)

### Actions

[](#actions)

> Actions show the results and progress of asynchronous requests to the API.

[Source (HCloud API Documentation)](https://docs.hetzner.cloud/#resources-actions)

```
// retrieve all actions
$actions = $client->actions->all();

// get one action
$action = $client->actions->show($actionId);
```

### Images

[](#images)

> Images are blueprints for your VM disks.

[Source (HCloud API Documentation)](https://docs.hetzner.cloud/#resources-images)

```
// retrieve all images
$images = $client->images->all();

// get one image
$image = $client->images->show($imageId);
```

### Pricing

[](#pricing)

> Returns prices for all resources available on the platform. VAT and currency of the project owner are used for calculations.
>
> Both net and gross prices are included in the response.

[Source (HCloud API Documentation)](https://docs.hetzner.cloud/#resources-pricing-get)

```
// retrieve all prices
$prices = $client->pricing->all();
```

### Servers

[](#servers)

> Servers are virtual machines that can be provisioned.

[Source (HCloud API Documentation)](https://docs.hetzner.cloud/#resources-servers)

```
// retrieve all servers
$server = $client->servers->all();

// get one server
$server = $client->servers->show($serverId);

// create a server
$server = $client->servers->create($parameters);

// rename a server
$server = $client->servers->rename($serverId, $newName);

// remove a server
$client->servers->remove($serverId);
```

### ServerActions

[](#serveractions)

Apply actions to your servers and retrieve progress/status messages.

[Source (HCloud API Documentation)](https://docs.hetzner.cloud/#resources-server-actions)

```
// retrieve all server actions
$actions = $client->server_actions->all();

// get one server action
$action = $client->server_actions->show($actionId);

// powerOn
$action = $client->server_actions->powerOn($serverId);

// reboot
$action = $client->server_actions->reboot($serverId);

// reset
$action = $client->server_actions->reset($serverId);

// powerOn
$action = $client->server_actions->powerOn($serverId);

// shutdown
$action = $client->server_actions->shutdown($serverId);

// powerOff
$action = $client->server_actions->powerOff($serverId);

// resetPassword
$action = $client->server_actions->resetPassword($serverId);

// enableRescueMode
$action = $client->server_actions->enableRescueMode($serverId);

// disableRescueMode
$action = $client->server_actions->disableRescueMode($serverId);

// createImage
$action = $client->server_actions->createImage($serverId, $parameters);

// rebuild
$action = $client->server_actions->rebuild($serverId, $parameters);

// changeType
$action = $client->server_actions->changeType($serverId, $parameters);

// enableBackup
$action = $client->server_actions->enableBackup($serverId, $parameters);

// disableBackup
$action = $client->server_actions->disableBackup($serverId);

// attachIso
$action = $client->server_actions->attachIso($serverId, $parameters);

// detachIso
$action = $client->server_actions->detachIso($serverId);

// changeDnsPtr
$action = $client->server_actions->changeDnsPtr($serverId, $parameters);

// changeProtection
$action = $client->server_actions->detachIso($serverId, $parameters);

// requestConsole
$action = $client->server_actions->requestConsole($serverId);
```

### SSH Keys

[](#ssh-keys)

> SSH keys are public keys you provide to the cloud system.

[Source (HCloud API Documentation)](https://docs.hetzner.cloud/#resources-ssh-keys)

```
// retrieve all SSH Keys
$keys = $client->ssh_keys->all();

// get one SSH Key
$key = $client->ssh_keys->show($keyId);

// create a SSH Key
$key = $client->ssh_keys->create($parameters);

// rename a SSH Key
$key = $client->ssh_keys->rename($keyId, $name);

// remove a SSH Key
$key = $client->ssh_keys->remove($keyId);
```

Usage with Symfony
------------------

[](#usage-with-symfony)

This library uses the [httpplug](http://httplug.io/) client library. The project provides a [Symfony bundle](http://docs.php-http.org/en/latest/integrations/symfony-bundle.html). When installed, you can directly integrate the client library to make the API queries visible and debuggable:

```
# in config/services.yaml

parameters:
    hetzner_token: '...'

# Hetzner API Base Client
CedricZiel\HetznerCloudAPI\Client:
    factory: ['CedricZiel\HetznerCloudAPI\Client', 'createWithHttpClient']
    arguments:
      - '@httplug.client.app'
    calls:
      - ['authenticate', ['%hetzner_token%', !php/const CedricZiel\HetznerCloudAPI\Client::AUTH_HTTP_TOKEN]]

# You can add a client service for the different resource types if you like:
CedricZiel\HetznerCloudAPI\Api\DataCenters:
    factory: ['@CedricZiel\HetznerCloudAPI\Client', 'api']
    arguments:
      - 'data_centers'

CedricZiel\HetznerCloudAPI\Api\ServerTypes:
    factory: ['@CedricZiel\HetznerCloudAPI\Client', 'api']
    arguments:
      - 'server_types'
```

Credits
-------

[](#credits)

The project is **heavily** inspired by the [Gitlab PHP API Client](https://github.com/m4tthumphrey/php-gitlab-api) by @m4tthumphrey.

License
-------

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2952d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ac8297e12671d91305ec01ab56add8cb141fa82d678ba96f0012eeb7f88ea0c?d=identicon)[cedricziel](/maintainers/cedricziel)

---

Top Contributors

[![cedricziel](https://avatars.githubusercontent.com/u/418970?v=4)](https://github.com/cedricziel "cedricziel (18 commits)")

---

Tags

api-clienthetzner-cloudhttpplugphp

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[m4tthumphrey/php-gitlab-api

GitLab API v4 client for PHP

9485.4M64](/packages/m4tthumphrey-php-gitlab-api)[jolicode/slack-php-api

An up to date PHP client for Slack's API

2534.4M12](/packages/jolicode-slack-php-api)[cloudconvert/cloudconvert-php

PHP SDK for CloudConvert APIs

2223.4M7](/packages/cloudconvert-cloudconvert-php)[j0k3r/graby

Graby helps you extract article content from web pages

384349.6k2](/packages/j0k3r-graby)[darthsoup/php-whmcs-api

WHMCS API client for PHP

2317.3k4](/packages/darthsoup-php-whmcs-api)

PHPackages © 2026

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