PHPackages                             jojo1981/php-types - 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. jojo1981/php-types

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

jojo1981/php-types
==================

PHP types library which contains value classes which represent the php types

5.0.0(4mo ago)117.4k↓21.9%2MITPHPPHP ^8.0CI passing

Since Jan 7Pushed 4mo ago1 watchersCompare

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

READMEChangelogDependencies (5)Versions (10)Used By (2)

PHP types library which contains value classes which represent the php types
============================================================================

[](#php-types-library-which-contains-value-classes-which-represent-the-php-types)

[![Build Status](https://github.com/jojo1981/php-types/actions/workflows/build.yml/badge.svg)](https://github.com/jojo1981/php-types/actions/workflows/build.yml)[![Coverage Status](https://camo.githubusercontent.com/43f46286306e76349b05059a75d85275d32b5bf961d4d4f42cdc3dfdac3c1e3e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6a6f6a6f313938312f7068702d74797065732f62616467652e737667)](https://coveralls.io/github/jojo1981/php-types)[![Latest Stable Version](https://camo.githubusercontent.com/fbaf61b2607199018a803ab41ec142984a783019ebe19043847506eba190d280/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6a6f313938312f7068702d74797065732f762f737461626c65)](https://packagist.org/packages/jojo1981/php-types)[![Total Downloads](https://camo.githubusercontent.com/871208caf9170ef8094f9ad7ecd2d7919ba9894ffeac08b9599c6ff6af905e77/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6a6f313938312f7068702d74797065732f646f776e6c6f616473)](https://packagist.org/packages/jojo1981/php-types)[![License](https://camo.githubusercontent.com/cebf00d430dcd7c8b8a77c4b8618acf742e5f428fbfe1a4274e0c52f3fff15e3/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6a6f313938312f7068702d74797065732f6c6963656e7365)](https://packagist.org/packages/jojo1981/php-types)

Author: Joost Nijhuis &lt;&gt;

This library has some value classes which represent a PHP type. These value classes can be constructed based on the PHP type name or based on a value. There are 2 pseudo type classes: `Jojo1981\PhpTypes\MixedType` and `Jojo1981\PhpTypes\MultiType` which will function as composite. Also, an abstract factory class is included: `Jojo1981\PhpTypes\AbstractType`.

The following types are supported, with their aliases:

- array
- bool (boolean)
- callable (callback)
- class
- float (number, real, double)
- int (integer)
- iterable
- null
- object
- resource
- string (text)
- void

Pseudo types:

- mixed
- multi

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

[](#installation)

### Library

[](#library)

```
git clone https://github.com/jojo1981/php-types.git
```

### Composer

[](#composer)

[Install PHP Composer](https://getcomposer.org/doc/00-intro.md)

```
composer require jojo1981/php-types
```

Basic usage
-----------

[](#basic-usage)

```
