Laravel Hetzner Storagebox

PHP MIT

Production-ready Laravel package for integrating Hetzner Storage Box into Laravel applications using the native Storage facade and filesystem API.

Stars
19
Forks
0
Downloads
2,357
Open Issues
0
Files main

Repository Files

Loading file structure...
src/Responses/StorageBoxCreateResponse.php
<?php

namespace GhostCompiler\Hetzner\StorageBox\Responses;

use GhostCompiler\Hetzner\StorageBox\DTOs\Action;
use GhostCompiler\Hetzner\StorageBox\DTOs\StorageBox;

class StorageBoxCreateResponse
{
    public StorageBox $storageBox;

    public ?Action $action = null;

    public function __construct(StorageBox $storageBox, ?Action $action = null)
    {
        $this->storageBox = $storageBox;
        $this->action = $action;
    }

    /**
     * Create response wrapper from raw API data.
     */
    public static function fromArray(array $data): self
    {
        $storageBox = StorageBox::fromArray($data['storage_box'] ?? []);
        $action = isset($data['action']) ? Action::fromArray($data['action']) : null;

        return new self($storageBox, $action);
    }
}