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/DTOs/StorageBoxSnapshot.php
<?php

namespace GhostCompiler\Hetzner\StorageBox\DTOs;

class StorageBoxSnapshot
{
    public int $id;

    public string $name;

    public ?string $description = null;

    public bool $isAutomatic;

    public array $labels = [];

    public string $created;

    public ?array $stats = null;

    /**
     * Create a new DTO instance from array data.
     */
    public static function fromArray(array $data): self
    {
        $snap = new self;
        $snap->id = (int) ($data['id'] ?? 0);
        $snap->name = (string) ($data['name'] ?? '');
        $snap->description = isset($data['description']) ? (string) $data['description'] : null;
        $snap->isAutomatic = (bool) ($data['is_automatic'] ?? false);
        $snap->labels = (array) ($data['labels'] ?? []);
        $snap->created = (string) ($data['created'] ?? '');
        $snap->stats = isset($data['stats']) ? (array) $data['stats'] : null;

        return $snap;
    }
}