PHPackages                             ghostcompiler/laravel-hetzner-cloud - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. ghostcompiler/laravel-hetzner-cloud

ActiveLibrary[HTTP &amp; Networking](/categories/http)

ghostcompiler/laravel-hetzner-cloud
===================================

Production-ready Laravel SDK for the Hetzner Cloud API

1.0.0(1mo ago)192.3kMITPHPPHP ^8.2 || ^8.3 || ^8.4 || ^8.5CI failing

Since Jun 11Pushed 3w agoCompare

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

READMEChangelog (1)Dependencies (9)Versions (2)Used By (0)

 [![Laravel Hetzner Cloud](https://camo.githubusercontent.com/7a311440d646263aeef835cc3b8d3f30b2c35f8fbf32c26ecf9a971070371ca9/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f646a6776666c3174762f696d6167652f75706c6f61642f76313738303636363739312f6c6f676f5f6d716e716e342e706e67)](https://camo.githubusercontent.com/7a311440d646263aeef835cc3b8d3f30b2c35f8fbf32c26ecf9a971070371ca9/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f646a6776666c3174762f696d6167652f75706c6f61642f76313738303636363739312f6c6f676f5f6d716e716e342e706e67)

Laravel Hetzner Cloud SDK
=========================

[](#laravel-hetzner-cloud-sdk)

 A premium, feature-rich PHP SDK and Laravel integration for the Hetzner Cloud API, featuring rate-limit handling, automatic retries, and concurrent batch operations.

 [![Laravel](https://camo.githubusercontent.com/afee0cfa7253c01ebb1c83448d41b8ddd9d091dd5bc9e00b4533da6faa715e97/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3131253230253743253230313225323025374325323031332d4646324432303f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/afee0cfa7253c01ebb1c83448d41b8ddd9d091dd5bc9e00b4533da6faa715e97/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3131253230253743253230313225323025374325323031332d4646324432303f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465) [![PHP Version](https://camo.githubusercontent.com/22a8463a63c7c9f605dbc977742748c940ec017f0a569bcea7fe0f1144b9087a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e32253230746f253230382e352d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/22a8463a63c7c9f605dbc977742748c940ec017f0a569bcea7fe0f1144b9087a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e32253230746f253230382e352d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465) [![Hetzner Cloud API](https://camo.githubusercontent.com/7fedce81439a7d4da55fac9176c78b4c47cae35aa65520eac3e41004204d851a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4865747a6e65722d2d436c6f75642d4150492d4438353031323f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/7fedce81439a7d4da55fac9176c78b4c47cae35aa65520eac3e41004204d851a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4865747a6e65722d2d436c6f75642d4150492d4438353031323f7374796c653d666f722d7468652d6261646765) [![Ghost Compiler](https://camo.githubusercontent.com/929b6dba84633d06d1f92f362e1226d9ae8489c83d8d5294df8817b1192edf88/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275696c7425323042792d47686f7374253230436f6d70696c65722d3046313732413f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/929b6dba84633d06d1f92f362e1226d9ae8489c83d8d5294df8817b1192edf88/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275696c7425323042792d47686f7374253230436f6d70696c65722d3046313732413f7374796c653d666f722d7468652d6261646765)

 [![](https://camo.githubusercontent.com/cdf476749c6ce3d70c50a215aa5c177735b6884cc8f3d0aecbdeb96b39f5b01e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f67686f7374636f6d70696c65722f6c61726176656c2d6865747a6e65722d636c6f75643f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)](https://camo.githubusercontent.com/cdf476749c6ce3d70c50a215aa5c177735b6884cc8f3d0aecbdeb96b39f5b01e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f67686f7374636f6d70696c65722f6c61726176656c2d6865747a6e65722d636c6f75643f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562) [![](https://camo.githubusercontent.com/5e45947093e53ef2e80dd4c99f2c32c524a749cf3218a5b34d3773b3714fa01f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67686f7374636f6d70696c65722f6c61726176656c2d6865747a6e65722d636c6f75643f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374)](https://camo.githubusercontent.com/5e45947093e53ef2e80dd4c99f2c32c524a749cf3218a5b34d3773b3714fa01f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67686f7374636f6d70696c65722f6c61726176656c2d6865747a6e65722d636c6f75643f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374)

---

Features
--------

[](#features)

- **100% Endpoint Coverage**: Complete implementation of all servers, volumes, networks, firewalls, load balancers, IPs, and supporting resources.
- **Fail-Safe Retries &amp; Backoff**: Robust exponential backoff and rate-limit parsing handling `RateLimit-Reset` response headers automatically.
- **Concurrently Pooled Processing**: Execute calls asynchronously or concurrently in batches.
- **Dynamic Filter Builder**: Fluent query-building for filtering, page indexing, and sorting.
- **Type-Safe DTOs**: Automated data hydration into standard PHP DTO structures.
- **Custom Exceptions**: Specialized mapping of API status codes.

---

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

[](#installation)

Install the package via Composer:

```
composer require ghostcompiler/laravel-hetzner-cloud
```

Publish the configuration file:

```
php artisan vendor:publish --provider="Vendor\HetznerCloud\Providers\HetznerCloudServiceProvider" --tag="config"
```

Add your Hetzner Cloud API Token to your `.env` file:

```
HETZNER_CLOUD_TOKEN=your_api_token_here
HETZNER_CLOUD_TIMEOUT=30
HETZNER_CLOUD_RETRIES=3
HETZNER_CLOUD_RETRY_BACKOFF=100
HETZNER_CLOUD_LOGGING_ENABLED=true
```

---

Usage Examples
--------------

[](#usage-examples)

### Servers

[](#servers)

#### Listing and Filtering Servers

[](#listing-and-filtering-servers)

```
use Vendor\HetznerCloud\Facades\Hetzner;

// List the first 50 servers matching a name, sorted by creation date
$servers = Hetzner::servers()
    ->filter(['name' => 'web-01'])
    ->sort('created:desc')
    ->perPage(50)
    ->page(1)
    ->get();

foreach ($servers as $server) {
    echo $server->name . ': ' . $server->status . "\n";
}
```

#### Paginated Results

[](#paginated-results)

```
$paginated = Hetzner::servers()->paginate(25, 2);

$servers = $paginated->items; // ServerCollection
$meta = $paginated->pagination; // PaginationMeta DTO

echo "Page: " . $meta->page . " of " . $meta->lastPage;
```

#### Creating and Deleting a Server

[](#creating-and-deleting-a-server)

```
// Create a new server
$response = Hetzner::servers()->create([
    'name' => 'database-prod',
    'server_type' => 'cx22',
    'image' => 'ubuntu-24.04',
    'location' => 'fsn1',
]);

$server = $response->server;
$action = $response->action;
$rootPassword = $response->rootPassword;

echo "Provisioned server ID: " . $server->id . "\n";
echo "Initial Root Password: " . $rootPassword . "\n";

// Delete the server
$deleteAction = Hetzner::servers()->delete($server->id);
if ($deleteAction) {
    echo "Deletion status: " . $deleteAction->status;
}
```

#### Triggering Server Actions

[](#triggering-server-actions)

```
// Power off a server
$action = Hetzner::servers()->powerOff($serverId);
echo "Action status: " . $action->status; // running / success

// Attach an ISO
Hetzner::servers()->attachIso($serverId, 'ubuntu-24.04-preinstall');
```

---

### Volumes

[](#volumes)

```
// Create a volume
$response = Hetzner::volumes()->create([
    'name' => 'data-disk',
    'size' => 100,
    'location' => 'fsn1'
]);

$volume = $response->volume;

// Attach volume to a server
Hetzner::volumes()->attach($volume->id, $serverId);

// Resize volume
Hetzner::volumes()->resize($volume->id, 250);
```

---

### Firewalls

[](#firewalls)

```
// Apply firewall to a server
$action = Hetzner::firewalls()->apply($firewallId, $serverId);

// Remove firewall from a server
Hetzner::firewalls()->remove($firewallId, $serverId);
```

---

### Asynchronous Requests

[](#asynchronous-requests)

```
// Return a Guzzle Promise immediately
$promise = Hetzner::servers()->async()->all();

// Resolve promise when ready
$servers = $promise->wait();
```

---

### Batch Concurrent Operations

[](#batch-concurrent-operations)

```
// Execute multiple queries concurrently
$results = Hetzner::batch([
    fn () => Hetzner::servers()->find(1),
    fn () => Hetzner::servers()->find(2),
    fn () => Hetzner::volumes()->find(10),
]);

$server1 = $results[0];
$server2 = $results[1];
$volume = $results[2];
```

---

### Exception Handling

[](#exception-handling)

All exceptions inherit from `Vendor\HetznerCloud\Exceptions\HetznerException`.

```
use Vendor\HetznerCloud\Exceptions\AuthenticationException;
use Vendor\HetznerCloud\Exceptions\ValidationException;
use Vendor\HetznerCloud\Exceptions\RateLimitException;
use Vendor\HetznerCloud\Exceptions\HetznerException;

try {
    Hetzner::servers()->create(['name' => '']);
} catch (AuthenticationException $e) {
    // 401 Unauthorized
} catch (ValidationException $e) {
    // 422 Unprocessable Entity
    $errors = $e->getErrors(); // Get field-specific validation errors
} catch (RateLimitException $e) {
    // 429 Rate Limit Exceeded
    $secondsToWait = $e->getSecondsUntilReset();
} catch (HetznerException $e) {
    // Base exception handler
}
```

---

Static Analysis &amp; Linting
-----------------------------

[](#static-analysis--linting)

Run PHPStan static analysis:

```
vendor/bin/phpstan analyse
```

Run Psalm static analysis:

```
vendor/bin/psalm
```

Format code with Pint:

```
vendor/bin/pint
```

---

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance94

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

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

45d ago

### Community

Maintainers

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

---

Top Contributors

[![ghost-maintainer](https://avatars.githubusercontent.com/u/269910969?v=4)](https://github.com/ghost-maintainer "ghost-maintainer (16 commits)")[![ghostcompiler](https://avatars.githubusercontent.com/u/269910969?v=4)](https://github.com/ghostcompiler "ghostcompiler (15 commits)")

---

Tags

api-clientcloudcloud-apicloud-sdkdevopsguzzlehcloudhetznerhetzner-cloudinfrastructurelaravellaravel-packagephpsdkserver-management

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ghostcompiler-laravel-hetzner-cloud/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[mateusjunges/laravel-kafka

A kafka driver for laravel

7253.6M21](/packages/mateusjunges-laravel-kafka)[illuminate/http

The Illuminate Http package.

11937.9M7.5k](/packages/illuminate-http)[illuminate/filesystem

The Illuminate Filesystem package.

15265.2M3.3k](/packages/illuminate-filesystem)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)

PHPackages © 2026

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