PHPackages                             typhoon/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. typhoon/type

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

typhoon/type
============

Typhoon Type System

0.8.1(2mo ago)6462.7k↓29.7%2[2 issues](https://github.com/typhoon-php/type/issues)[1 PRs](https://github.com/typhoon-php/type/pulls)11MITPHPPHP ^8.3CI passing

Since Mar 1Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/typhoon-php/type)[ Packagist](https://packagist.org/packages/typhoon/type)[ Fund](https://www.tinkoff.ru/cf/5MqZQas2dk7)[ RSS](/packages/typhoon-type/feed)WikiDiscussions 0.8.x Synced yesterday

READMEChangelog (10)Dependencies (9)Versions (26)Used By (11)

Typhoon Type
============

[](#typhoon-type)

[![PHP Version Requirement](https://camo.githubusercontent.com/1723ad8fa4d5bde549ec3a75c9a1efeeaa7bcfd35caf46d02ccf693acacd1fe4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f747970686f6f6e2f747970652f706870)](https://packagist.org/packages/typhoon/type)[![GitHub Release](https://camo.githubusercontent.com/9b0a5a522bd3f74daed2656e104cfbb1e4a276d736a0b7febf6b12c35e076fc3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f747970686f6f6e2d7068702f74797065)](https://github.com/typhoon-php/type/releases)[![PHPStan](https://camo.githubusercontent.com/bae4405f2c691127e0007aacdbc9e979070ddf9eab70b1ef57fcbc46af598a44/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068707374616e2532306c6576656c2d6d61782d627269676874677265656e2e7376673f7374796c653d666c6174266c6f676f3d706870)](phpstan.dist.neon)[![Code Coverage](https://camo.githubusercontent.com/5c3943a8a52d3626b43260ade3c1b460a19de247b988ef2faf9db22874632673/68747470733a2f2f636f6465636f762e696f2f67682f747970686f6f6e2d7068702f747970652f6272616e63682f302e382e782f67726170682f62616467652e737667)](https://codecov.io/gh/typhoon-php/type/tree/0.8.x)[![Mutation testing badge](https://camo.githubusercontent.com/d388d5c083eb2cd7b87546d3577248c4b34463da350e28dd74cf495292f63890/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246747970686f6f6e2d70687025324674797065253246302e382e78)](https://dashboard.stryker-mutator.io/reports/github.com/typhoon-php/type/0.8.x)

Typhoon Type is an object abstraction over the modern PHP type system. Use this library to build tools that work with sophisticated types:

```
use function Typhoon\Type\arrayShapeT;
use function Typhoon\Type\objectT;
use function Typhoon\Type\nonEmptyListT;

$json =  nonEmptyListT(objectT(Person::class)),
]);

$request = new Mapper()->map($json, $type);
```

Installation
------------

[](#installation)

```
composer require typhoon/type

```

Printing types
--------------

[](#printing-types)

To print any type, use `stringify()`:

```
use function Typhoon\Type\stringify;

$type = arrayShapeT([
    'people' => nonEmptyListT(objectT(Person::class)),
]);

var_dump(stringify($type));

// array{'people': non-empty-list}
```

Supported types
---------------

[](#supported-types)

### Native

[](#native)

TyphoonNative`nullT``null``voidT``void``neverT``never``falseT``false``trueT``true``boolT``bool``intT``int``floatT``float``stringT``string``arrayT``array``objectT``object``objectT(Foo::class)``Foo``selfT``self``parentT``parent``staticT``static``iterableT``iterable``callableT``callable``resourceT``resource``nullOrT(stringT)``?string``unionT(intT, stringT)``int|string``intersectionT(objectT(Countable::class), objectT(Traversable::class))``Countable&Traversable``mixedT``mixed`### PHPDoc numbers

[](#phpdoc-numbers)

TyphoonPHPDoc`intT(123)``123``positiveIntT``positive-int``negativeIntT``negative-int``nonPositiveIntT``non-positive-int``nonNegativeIntT``non-negative-int``nonZeroIntT``non-zero-int``intRangeT(-5, 6)``int``intRangeT(max: 6)``int``intRangeT(min: -5)``int``intMaskT(1, 2, 4)``int-mask``intMaskT(classConstantMaskT(Foo::class, 'INT_*')``int-mask-of``floatT(12.5)``12.5``floatRangeT(-0.001, 2.344)``float`### PHPDoc strings

[](#phpdoc-strings)

TyphoonPHPDoc`nonEmptyStringT``non-empty-string``truthyStringT`, `nonFalsyStringT``truthy-string`, `non-falsy-string``numericStringT``numeric-string``lowercaseString``lowercase-string``stringT('abc')``'abc'``classT(Foo::class)`, `classStringT(Foo::class)`, `classT(objectT(Foo::class))``class-string``stringT(Foo::class)`, `classConstantT(Foo::class, 'class')``Foo::class``literalStringT``literal-string`### PHPDoc constants

[](#phpdoc-constants)

TyphoonPHPDoc`constantT('PHP_INT_MAX')``PHP_INT_MAX``constantMaskT('JSON_*')``JSON_*``classConstantT(Foo::class, 'BAR')``Foo::BAR``classConstantMaskT(Foo::class, 'IS_*')``Foo::IS_*`### PHPDoc arrays and iterables

[](#phpdoc-arrays-and-iterables)

TyphoonPHPDoc`arrayT(value: objectT(Foo::class))``Foo[]``listT(stringT)``list``nonEmptyListT(stringT)``non-empty-list``listShapeT([intT, stringT])``list{int, string}``arrayShapeT([intT, optional(stringT)])``list{int, 1?: string}``unsealedListShapeT([intT])``list{int, ...}``unsealedListShapeT([intT], stringT)``list{int, ...}``arrayT(value: stringT)``array``arrayT(intT, stringT)``array``nonEmptyArrayT(arrayKeyT, stringT)``non-empty-array``arrayShapeT()``array{}``arrayShapeT([intT, stringT])``array{int, string}``arrayShapeT([intT, 'a' => optional(stringT)])``array{int, a?: string}``unsealedArrayShapeT([intT])``array{int, ...}``unsealedArrayShapeT([floatT], intT, stringT)``array{float, ...}``keyOfT(classConstantT(Foo::class, 'ARRAY'))``key-of``valueOfT(classConstantT(Foo::class, 'ARRAY'))``value-of``offsetT($TArray->type, $TKey->type)``TArray[TKey]``iterableT(objectT, stringT)``iterable``iterableT(value: stringT)``iterable`### PHPDoc objects

[](#phpdoc-objects)

TyphoonPHPDoc`objectT(Foo::class, [stringT, floatT])``Foo``selfT([stringT, floatT])``self``parentT([stringT, floatT])``parent``staticT([stringT, floatT])``static``objectShapeT(['prop' => stringT])``object{prop: string}``objectShapeT(['prop' => optional(stringT))])``object{prop?: string}`### PHPDoc callables

[](#phpdoc-callables)

TyphoonPHPDoc`callableT([stringT], voidT)``callable(string): void``callableT([param(stringT, default: true)])``callable(string=): mixed``callableT([param(stringT, variadic: true)])``callable(string...): mixed``callableT([param(stringT, byRef: true)])``callable(string&): mixed``closureT([stringT], voidT)``Closure(string): void``closureT([param(stringT, default: true)])``Closure(string=): mixed``closureT([param(stringT, variadic: true)])``Closure(string...): mixed``closureT([param(stringT, byRef: true)])``Closure(string&): mixed`### Union aliases

[](#union-aliases)

TyphoonPHPDoc`array-key``arrayKeyT``numericT``numeric``scalarT``scalar`

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance85

Actively maintained with recent releases

Popularity43

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 99.6% 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 ~50 days

Recently: every ~38 days

Total

24

Last Release

71d ago

PHP version history (3 changes)0.1.0PHP ^8.1

0.5.0PHP ^8.2

0.8.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2552865?v=4)[Valentin Udaltsov](/maintainers/vudaltsov)[@vudaltsov](https://github.com/vudaltsov)

---

Top Contributors

[![vudaltsov](https://avatars.githubusercontent.com/u/2552865?v=4)](https://github.com/vudaltsov "vudaltsov (503 commits)")[![klimick](https://avatars.githubusercontent.com/u/34217190?v=4)](https://github.com/klimick "klimick (2 commits)")

---

Tags

phpphp-library

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M305](/packages/laravel-horizon)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[illuminate/support

The Illuminate Support package.

630113.0M41.3k](/packages/illuminate-support)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[rubix/ml

A high-level machine learning and deep learning library for the PHP language.

2.2k1.5M28](/packages/rubix-ml)[illuminate/collections

The Illuminate Collections package.

27078.0M1.1k](/packages/illuminate-collections)

PHPackages © 2026

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