Laravel Hetzner Cloud

PHP MIT

Production-ready Laravel SDK for the Hetzner Cloud API with support for servers, volumes, networks, firewalls, load balancers, SSH keys, floating IPs, and more.

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

Repository Files

Loading file structure...
src/DTOs/PlacementGroup.php
<?php

namespace Vendor\HetznerCloud\DTOs;

class PlacementGroup
{
    public int $id;

    public string $name;

    public string $type;

    public array $servers = [];

    public string $created;

    public array $labels = [];

    /**
     * Create a new DTO instance from array data.
     */
    public static function fromArray(array $data): self
    {
        $group = new self;
        $group->id = (int) ($data['id'] ?? 0);
        $group->name = (string) ($data['name'] ?? '');
        $group->type = (string) ($data['type'] ?? '');
        $group->servers = (array) ($data['servers'] ?? []);
        $group->created = (string) ($data['created'] ?? '');
        $group->labels = (array) ($data['labels'] ?? []);

        return $group;
    }
}