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

namespace GhostCompiler\Hetzner\StorageBox\DTOs;

class StorageBoxType
{
    public int $id;

    public string $name;

    public string $description;

    public int $subaccountLimit;

    public int $snapshotLimit;

    public array $prices = [];

    /**
     * Create a new DTO instance from array data.
     */
    public static function fromArray(array $data): self
    {
        $type = new self;
        $type->id = (int) ($data['id'] ?? 0);
        $type->name = (string) ($data['name'] ?? '');
        $type->description = (string) ($data['description'] ?? '');
        $type->subaccountLimit = (int) ($data['subaccount_limit'] ?? 0);
        $type->snapshotLimit = (int) ($data['snapshot_limit'] ?? 0);
        $type->prices = (array) ($data['prices'] ?? []);

        return $type;
    }
}