PHPackages                             takeoto/type - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. takeoto/type

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

takeoto/type
============

The tool for the confident value usage.

1.0(2y ago)02MITPHPPHP &gt;=8.0

Since Jun 2Pushed 2y ago1 watchersCompare

[ Source](https://github.com/takeoto/type)[ Packagist](https://packagist.org/packages/takeoto/type)[ RSS](/packages/takeoto-type/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

The type
========

[](#the-type)

#### Tools for manipulation of data types

[](#tools-for-manipulation-of-data-types)

```
use \Takeoto\Type\Type;

# Simple type verification
Type::int(123);
Type::string('someString');
# etc.

$array = [
    'key0' => 'key0_value',
    'key1' => [
        'key1.1' => 12345,
    ],
];

# ArrayX type
Type::arrayX($array)->get('key0123'); # ArrayXKeyNotFound: The key "key0123" does not exist!
Type::arrayX($array)->get('key0')->string(); # "key0_value"
Type::arrayX($array)->get('key0')->int(); # Expected an integer. Got: string in
Type::arrayX($array)->get('key0')->errorIfNot('Yours custom error message!')->int(); # Yours custom error message!
$arrayX = Type::arrayX($array);
$arrayX['key1']['key1.1']->int(); # 12345

# ObjectX type
class SomeClass {
    public mixed $publicProperty = 'the value of $publicProperty';
    private mixed $privateProperty = 'the value of $privateProperty';

    public static function getPrivateProperty(): mixed
    {
        return $this->privateProperty;
    }
}
$object = new SomeClass();
Type::objectX($object)->publicProperty->string(); # "the value of $publicProperty"
Type::objectX($object)->publicProperty->int(); # Error
Type::objectX($object)->getPrivateProperty()->string(); # "the value of $privateProperty"
Type::objectX($object)->getPrivateProperty()->int(); # Error

# Shortcuts
Type::arrayXGet($array, 'key0123');
Type::arrayXGetString($array, 'key0');
Type::arrayXGetStringXLengthMax($array, 'key0', 10);
Type::arrayXGetStringXLength($array, 'key0', 0, 12);
Type::arrayXGetInt($array, 'key0');
Type::arrayXGetErrorIfNotInt($array, 'key0', 'Yours custom error message!');

# Multiple type
Type::arrayXGetStringX($array, 'key0')->lengthMin(5);
Type::arrayXGetStringXlengthMin($array, 'key0', 5);
Type::arrayXGetErrorIfNotNullOrString($array, 'key0', 'Yours custom error message!');
Type::notIntAndNotString(123);

# IS condition
Type::isNotIntAndNotString([]); # true
Type::arrayXGetIsNotStringOrStringInt([0 => '123'], 0); # true
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

1081d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c96824c0ddfe9406005d8fdc97ee6c62bfa0931c298d195cb3e82af315918888?d=identicon)[takeoto](/maintainers/takeoto)

---

Tags

phptypecheckvalidationassertstrictmixedtakeoto

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/takeoto-type/health.svg)

```
[![Health](https://phpackages.com/badges/takeoto-type/health.svg)](https://phpackages.com/packages/takeoto-type)
```

###  Alternatives

[yorcreative/laravel-argonaut-dto

Argonaut is a lightweight Data Transfer Object (DTO) package for Laravel that supports nested casting, recursive serialization, and validation out of the box. Ideal for service layers, APIs, and clean architecture workflows.

1062.8k1](/packages/yorcreative-laravel-argonaut-dto)

PHPackages © 2026

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