PHPackages                             walnut/lib\_datatype - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. walnut/lib\_datatype

ActiveLibrary

walnut/lib\_datatype
====================

0.0.7(2y ago)01041PHP

Since Sep 12Pushed 2y ago1 watchersCompare

[ Source](https://github.com/kapitancho/walnut-lib-datatype)[ Packagist](https://packagist.org/packages/walnut/lib_datatype)[ RSS](/packages/walnut-lib-datatype/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (8)Used By (1)

OpenApi v.3 compatible data types
=================================

[](#openapi-v3-compatible-data-types)

Attribute based type annotation and validation

Examples
--------

[](#examples)

### Book

[](#book)

```
final class BookData {
    public function __construct(
        #[IntegerData(minimum: 1, maximum: 999999)]
        public /*readonly*/ int $numPages,

        #[StringData(minLength: 1, maxLength: 100)]
        public /*readonly*/ string $authorName,

        #[IntegerData(minimum: 1, maximum: 9999)]
        public /*readonly*/ int $issueYear,

        #[StringData(minLength: 1, maxLength: 100)]
        public /*readonly*/ string $publisherName,

        #[StringData(minLength: 1, maxLength: 30)]
        public /*readonly*/ string $language
    ) {}
}
```

```
class TestApi {

    public function __construct(

        #[IntegerData(minimum: 18)]
        public int $age,

        #[BooleanData]
        public bool $isConfirmed,

        #[NumberData(maximum: 1000, exclusiveMaximum: true)]
        public float $radius,

        #[StringData(minLength: 5)]
        public string $name,

        #[ArrayData(minItems: 2)]
        public array $players,

        #[ObjectData(required: ['city', 'zipCode'])]
        public object $info

    ) {}
}
```

```
#[ObjectData(required: ['name', 'country'])]
class Zoo {
    public function __construct(
        #[StringData(minLength: 2, maxLength: 20)]
        public string $name,
        #[StringData(minLength: 2, maxLength: 20)]
        public string $country
    ) {}
}

#[ObjectData(minProperties: 2, additionalPropertiesIn: 'tigerInfo')]
class Tiger {
    public function __construct(

        #[StringData(minLength: 2, maxLength: 20)]
        public string $name,

        #[IntegerData(minimum: 0, maximum: 99)]
        public int $age,

        #[ArrayData(minItems: 1), StringData]
        public array $favoriteFood,

        #[RefValue(Zoo::class)]
        public Zoo $zoo,

        #[StringData(minLength: 2, maxLength: 20)]
        public array $tigerInfo, //for all other properties

        #[ArrayData(nullable: true), ArrayData, IntegerData(minimum: 3)]
        public ?array $int2, //int[][]

        #[ArrayData(nullable: true), RefValue(Zoo::class)]
        public ?array $otherZoos //Zoo[]

    ) {}
}
```

```
#[ObjectTypedValue]
class Order {
    public function __construct(
        #[IntegerTypedValue(format: 'int64')]
        public int $id,
        #[IntegerTypedValue(format: 'int64')]
        public int $petId,
        #[IntegerTypedValue(format: 'int32')]
        public int $quantity,
        #[StringTypedValue(format: 'date-time')]
        public string $shipDate,
        #[StringTypedValue(enum: ['placed', 'approved', 'delivered'])]
        public string $status,
        #[BooleanTypedValue]
        public bool $complete,
    ) {}
}
```

```
final class Address {
    public function __construct(
        #[IntegerTypedValue(minimum: 1, maximum: 999999)]
        public int $id,
        #[StringTypedValue(minLength: 1, maxLength: 50)]
        public string $city,
        #[StringTypedValue(minLength: 1, maxLength: 100)]
        public string $street
    ) {}
}
final class Client {
    /**
     * Client constructor.
     * @param int $id
     * @param string $name
     * @param Address $address
     * @param Account|null $account
     * @param Contact[] $contacts
     */
    public function __construct(
        #[IntegerTypedValue(minimum: 1, maximum: 999999)]
        public int $id,
        #[StringTypedValue(minLength: 1, maxLength: 100)]
        public string $name,
        public Address $address,
        public ?Account $account,
        #[ArrayTypedValue, RefValue(targetClass: Contact::class)]
        public array $contacts
    ) {}
}
final class Account {
    public function __construct(
        #[IntegerTypedValue(minimum: 1, maximum: 999999)]
        public int $id,
        #[StringTypedValue(minLength: 1, maxLength: 100)]
        public string $account_name
    ) {}
}
final class Contact {
    /**
     * Account constructor.
     * @param int $id
     * @param string $contact_name
     * @param string $position
     * @param Phone[] $phones
     */
    public function __construct(
        #[IntegerTypedValue(minimum: 1, maximum: 999999)]
        public int $id,
        #[StringTypedValue(minLength: 1, maxLength: 100)]
        public string $contact_name,
        #[StringTypedValue(minLength: 1, maxLength: 50)]
        public string $position,
        #[ArrayTypedValue, RefValue(targetClass: Phone::class)]
        public array $phones
    ) {}
}
final class Phone {
    public function __construct(
        #[IntegerTypedValue(minimum: 1, maximum: 999999)]
        public int $id,
        #[StringTypedValue(minLength: 1, maxLength: 50)]
        public string $phone_number
    ) {}
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~143 days

Recently: every ~152 days

Total

7

Last Release

847d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/12d2910601119ce65c373b7e21ffc647154bde10c5ad0a0598ab1143aa851701?d=identicon)[kapitancho](/maintainers/kapitancho)

---

Top Contributors

[![kapitancho](https://avatars.githubusercontent.com/u/792682?v=4)](https://github.com/kapitancho "kapitancho (10 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/walnut-lib-datatype/health.svg)

```
[![Health](https://phpackages.com/badges/walnut-lib-datatype/health.svg)](https://phpackages.com/packages/walnut-lib-datatype)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
