hpkns/objkit

Create data objects from unstructured data

Maintainers

Details

github.com/hpkns/objkit

Source

Issues

Installs: 390

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

pkg:composer/hpkns/objkit

v1.0.1 2025-09-10 13:14 UTC

This package is auto-updated.

Last update: 2025-10-10 13:35:27 UTC


README

Create data objects from unstructured data

Installation

Simply get it from composer:

composer require hpkns/gadget

Usage

use Hpkns\Objkit\Attributes\ArrayOf;
use Hpkns\Objkit\Buildable;
use Hpkns\Objkit\ObjectBuilder;

class Person {
    use Buildable;
    
    public function __construct(
        readonly string $name,
        readonly int    $age,
        #[ArrayOf(Person)]
        readonly array  $parents = [],
    ) {
        //
    }
}

$jedi = Person::build([
    'name' => 'Luke',
    'age' => '19',
    'parents' => [
        [
            'name' => 'Anakin', 
            'age' => 41,
        ]
    ]
]);