ui-awesome/model

Typed model mapping for modern PHP applications.

Installs: 326

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/ui-awesome/model

0.1.0 2024-03-18 21:49 UTC

This package is auto-updated.

Last update: 2026-03-01 01:51:46 UTC


README

UIAwesome

UIAwesome Model for PHP


PHPUnit Mutation Testing PHPStan

Typed model mapping for modern PHP applications
Nested properties, controlled casting, timestamp attributes, and array serialization

Features

Feature Overview

Installation

composer require ui-awesome/model:^0.2

Quick start

<?php

declare(strict_types=1);

namespace App\Model;

use UIAwesome\Model\AbstractModel;
use UIAwesome\Model\Attribute\Timestamp;

final class User extends AbstractModel
{
    public string $name = '';
    public string $email = '';
    #[Timestamp]
    private int $updatedAt = 0;
}

$model = new User();

$model->load(
    [
        'User' => [
            'name' => 'Ada Lovelace',
            'email' => 'ada@example.com',
        ],
    ],
);

$model->setPropertyValue('name', 'Ada');
$types = $model->getPropertyTypes();
$payload = $model->toArray(snakeCase: true, exceptProperties: ['updatedAt']);

Documentation

For detailed configuration options and advanced usage.

Package information

PHP Latest Stable Version Total Downloads

Quality code

Codecov PHPStan Level Max StyleCI

Our social networks

Follow on X

License

License