PHPackages                             ghostcompiler/laravel-hetzner-storagebox - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. ghostcompiler/laravel-hetzner-storagebox

ActiveLibrary[File &amp; Storage](/categories/file-storage)

ghostcompiler/laravel-hetzner-storagebox
========================================

Production-ready Laravel SDK for the Hetzner Storage Box API

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

Since Jun 13Pushed 3w agoCompare

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

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

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

Laravel Hetzner Storage Box SDK
===============================

[](#laravel-hetzner-storage-box-sdk)

 A premium, feature-rich PHP SDK and Laravel integration for the Hetzner Storage Box 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 Storage Box API](https://camo.githubusercontent.com/a4a89eb386dcdf2df9b58f19f18bd9bea0fe43723dc5ddae4627dff9620b7391/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4865747a6e65722d2d53746f726167652d2d426f782d4150492d4438353031323f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/a4a89eb386dcdf2df9b58f19f18bd9bea0fe43723dc5ddae4627dff9620b7391/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4865747a6e65722d2d53746f726167652d2d426f782d4150492d4438353031323f7374796c653d666f722d7468652d6261646765) [![Ghost Compiler](https://camo.githubusercontent.com/929b6dba84633d06d1f92f362e1226d9ae8489c83d8d5294df8817b1192edf88/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275696c7425323042792d47686f7374253230436f6d70696c65722d3046313732413f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/929b6dba84633d06d1f92f362e1226d9ae8489c83d8d5294df8817b1192edf88/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275696c7425323042792d47686f7374253230436f6d70696c65722d3046313732413f7374796c653d666f722d7468652d6261646765)

 [![](https://camo.githubusercontent.com/e7b412905dee3a020f09b13bcf4ed03c5f890165637c914a49a1d19814d08599/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f67686f7374636f6d70696c65722f6c61726176656c2d6865747a6e65722d73746f72616765626f783f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)](https://camo.githubusercontent.com/e7b412905dee3a020f09b13bcf4ed03c5f890165637c914a49a1d19814d08599/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f67686f7374636f6d70696c65722f6c61726176656c2d6865747a6e65722d73746f72616765626f783f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562) [![](https://camo.githubusercontent.com/f18d4ed7a09cb28a322cd627a61b90a116e1ec81d364802fb8e58e13163a080b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67686f7374636f6d70696c65722f6c61726176656c2d6865747a6e65722d73746f72616765626f783f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374)](https://camo.githubusercontent.com/f18d4ed7a09cb28a322cd627a61b90a116e1ec81d364802fb8e58e13163a080b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67686f7374636f6d70696c65722f6c61726176656c2d6865747a6e65722d73746f72616765626f783f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374)

---

Features
--------

[](#features)

- **100% Endpoint Coverage**: Complete implementation of all storage boxes, subaccounts, snapshots, actions, and locations.
- **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-storagebox
```

Publish the configuration file using our simplified command installer:

```
php artisan ghost:storagebox install
```

Add your Hetzner Storage Box Console API Token to your `.env` file:

```
HETZNER_STORAGEBOX_TOKEN=your_api_token_here
HETZNER_STORAGEBOX_TIMEOUT=30
HETZNER_STORAGEBOX_RETRIES=3
HETZNER_STORAGEBOX_RETRY_BACKOFF=100
HETZNER_STORAGEBOX_LOGGING_ENABLED=true
```

---

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

[](#usage-examples)

You can access the SDK in three ways:

1. **Facade (Recommended for Laravel environments)**

```
use GhostCompiler\Hetzner\StorageBox\Facades\HetznerStorageBox;

$boxes = HetznerStorageBox::storageBoxes()->get();
```

2. **Global Helper (Convenience function)**

```
$boxes = HetznerStorageBox()->storageBoxes()->get();
```

3. **Dynamic Token Authentication (For multi-tenant or multi-account systems)**

```
$boxes = HetznerStorageBox('your_dynamic_token_here')->storageBoxes()->get();
```

---

### Storage Boxes

[](#storage-boxes)

#### Listing and Filtering Storage Boxes

[](#listing-and-filtering-storage-boxes)

```
use GhostCompiler\Hetzner\StorageBox\Facades\HetznerStorageBox;

// List the first 50 storage boxes matching a name
$boxes = HetznerStorageBox::storageBoxes()
    ->filter(['name' => 'box-01'])
    ->perPage(50)
    ->page(1)
    ->get();

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

#### Paginated Results

[](#paginated-results)

```
$paginated = HetznerStorageBox::storageBoxes()->paginate(25, 2);

$boxes = $paginated->items; // StorageBoxCollection
$meta = $paginated->pagination; // PaginationMeta DTO

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

#### Creating and Deleting a Storage Box

[](#creating-and-deleting-a-storage-box)

```
// Create a new storage box
$response = HetznerStorageBox::storageBoxes()->create([
    'name' => 'backups-prod',
    'storage_box_type' => 'bx11',
    'location' => 'fsn1',
    'password' => 'secure_password_here'
]);

$box = $response->storageBox;
$action = $response->action;

echo "Provisioned Storage Box ID: " . $box->id . "\n";

// Delete the storage box
$deleteAction = HetznerStorageBox::storageBoxes()->delete($box->id);
if ($deleteAction) {
    echo "Deletion status: " . $deleteAction->status;
}
```

#### Triggering Storage Box Actions

[](#triggering-storage-box-actions)

```
// Reset Storage Box password
$action = HetznerStorageBox::storageBoxes()->resetPassword($boxId, 'new_secure_password_123');
echo "Action status: " . $action->status; // running / success

// Change delete protection
HetznerStorageBox::storageBoxes()->changeProtection($boxId, true);
```

#### Listing Storage Box Folders

[](#listing-storage-box-folders)

```
$folders = HetznerStorageBox::storageBoxes()->folders($boxId, '/backups');
foreach ($folders['folders'] as $folder) {
    echo "Folder: " . $folder . "\n";
}
```

---

### Subaccounts

[](#subaccounts)

Manage directories and access protocols for subaccounts.

```
$subaccountsManager = HetznerStorageBox::storageBoxes()->subaccounts($boxId);

// List subaccounts
$subaccounts = $subaccountsManager->all();

// Create a subaccount
$sub = $subaccountsManager->create([
    'name' => 'upload-sub',
    'description' => 'Subaccount for uploads',
    'home_directory' => '/uploads',
    'access_settings' => [
        'samba_enabled' => false,
        'ssh_enabled' => true,
        'webdav_enabled' => true,
        'read_only' => false
    ]
]);

// Reset subaccount password
$subaccountsManager->resetPassword($sub->id, 'SecurePassword123!');
```

---

### Snapshots

[](#snapshots)

Manage point-in-time filesystem snapshots.

```
$snapshotsManager = HetznerStorageBox::storageBoxes()->snapshots($boxId);

// List snapshots
$snapshots = $snapshotsManager->all();

// Create a snapshot
$snapshot = $snapshotsManager->create([
    'description' => 'Daily backup snapshot',
    'labels' => [
        'env' => 'production'
    ]
]);

// Delete a snapshot
$snapshotsManager->delete($snapshot->id);
```

---

### Asynchronous Requests

[](#asynchronous-requests)

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

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

---

### Batch Concurrent Operations

[](#batch-concurrent-operations)

```
// Execute multiple queries concurrently
$results = HetznerStorageBox::batch([
    fn () => HetznerStorageBox::storageBoxes()->find(1),
    fn () => HetznerStorageBox::storageBoxes()->find(2),
    fn () => HetznerStorageBox::storageBoxTypes()->find(4),
]);

$box1 = $results[0];
$box2 = $results[1];
$type = $results[2];
```

---

### Exception Handling

[](#exception-handling)

All exceptions inherit from `GhostCompiler\Hetzner\StorageBox\Exceptions\HetznerException`.

```
use GhostCompiler\Hetzner\StorageBox\Exceptions\AuthenticationException;
use GhostCompiler\Hetzner\StorageBox\Exceptions\ValidationException;
use GhostCompiler\Hetzner\StorageBox\Exceptions\RateLimitException;
use GhostCompiler\Hetzner\StorageBox\Exceptions\HetznerException;

try {
    HetznerStorageBox::storageBoxes()->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

Maintenance93

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 55.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

47d 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 (5 commits)")[![ghostcompiler](https://avatars.githubusercontent.com/u/269910969?v=4)](https://github.com/ghostcompiler "ghostcompiler (4 commits)")

---

Tags

cloud-storagefile-storageflysystemhetznerhetzner-storage-boxlaravellaravel-filesystemlaravel-packagelaravel-storagephpwebdav

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[illuminate/filesystem

The Illuminate Filesystem package.

15265.2M3.3k](/packages/illuminate-filesystem)[psalm/plugin-laravel

Psalm plugin for Laravel

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

Create a static site bundle from a Laravel app

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

The official AI SDK for Laravel.

1.0k3.2M251](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k253.1k86](/packages/moonshine-moonshine)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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