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

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

ph-7/datatype
=============

List of the available PHP data types, nicely stored into readable constant names

v1.0.2(3y ago)74.4k22MITPHPPHP &gt;=7.3.0

Since Jan 7Pushed 3y ago1 watchersCompare

[ Source](https://github.com/pH-7/PHP-type-names)[ Packagist](https://packagist.org/packages/ph-7/datatype)[ GitHub Sponsors](https://github.com/pH-7)[ Fund](https://ko-fi.com/phenry)[ RSS](/packages/ph-7-datatype/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (2)

PHP type names ⚡️
=================

[](#php-type-names-️)

*Get all valid PHP type names with constants* ✅

📄 Overview
----------

[](#-overview)

*Simple library containing the list of constants for the available PHP data types. Use those constant types in your project when you need to mention a data type, use those constants instead of hardcoding them.*

⚙️ Requirements
---------------

[](#️-requirements)

- [PHP 7.3](https://www.php.net/releases/7_3_0.php) or newer.

⚙️ Installation
---------------

[](#️-installation)

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

```
composer require ph-7/datatype
```

🤠 Example
---------

[](#-example)

```
require_once __DIR__ . '/vendor/autoload.php';

use PH7\Datatype\Type;

$id = settype($_GET['id'], Type::STRING);

$name = settype($inputName, Type::STRING);
```

😋 Who cooked it?
----------------

[](#-who-cooked-it)

[![Pierre-Henry Soria](https://camo.githubusercontent.com/2e624b95003073bd56ecb43792155201b96f2e1d11bab1218e2215b6238c6ac2/68747470733a2f2f732e67726176617461722e636f6d2f6176617461722f61323130666536313235336334336338363964373165616564306539303134393f733d323030)](https://ph7.me "Pierre-Henry Soria personal website")

**[Pierre-Henry Soria](https://ph7.me)**, a highly passionate, zen &amp; pragmatic software engineer 😊

[![@phenrysay](https://camo.githubusercontent.com/9ebce40b5dc8ca37584b018fd5b5941319d135117ef1fb2330f4aa95877e79f5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f547769747465722d3144413146323f7374796c653d666f722d7468652d6261646765266c6f676f3d74776974746572266c6f676f436f6c6f723d7768697465)](https://twitter.com/phenrysay) [![pH-7](https://camo.githubusercontent.com/4fcd516e2fde608afc9ddd1330de295d23981c27a9b9d695f8abe51f70a1efc5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d3130303030303f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](https://github.com/pH-7)

📺 The Video
-----------

[](#-the-video)

[![Watch the video](https://camo.githubusercontent.com/b09fef3fed604e811a0b087816a59e26bb78c7459799ca6c01be8b5bed3cc934/68747470733a2f2f69312e7974696d672e636f6d2f76692f3976396737323264756c452f736464656661756c742e6a7067)](https://youtu.be/9v9g722dulE?t=453)

👉 **[Watch on YouTube](https://youtu.be/9v9g722dulE?t=453)** 👈

⚖️ License
----------

[](#️-license)

**PHP type names** is generously distributed under the *[MIT](https://opensource.org/licenses/MIT)*.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity47

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 ~166 days

Total

3

Last Release

1260d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.1.0

v1.0.1PHP &gt;=7.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b6d95da236687f1dca4f7d70d60037c70ef217120ea195df23a39a412ba594e0?d=identicon)[ph-7](/maintainers/ph-7)

---

Top Contributors

[![pH-7](https://avatars.githubusercontent.com/u/1325411?v=4)](https://github.com/pH-7 "pH-7 (33 commits)")

---

Tags

constantsdata-typesdatatypesmagic-numbersmagicnumbersphpphp-constantsphp-datatype-librarytype-nametype-namestypesconstantstypesphp typestype names

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ph-7-datatype/health.svg)

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

###  Alternatives

[rexlabs/enum

Enumeration (enum) implementation for PHP

48482.2k2](/packages/rexlabs-enum)[cekurte/environment

A library to get the values from environment variables and process to php data types

5884.0k7](/packages/cekurte-environment)[php-stubs/wordpress-globals

Global variables and global constants from WordPress core.

13799.0k17](/packages/php-stubs-wordpress-globals)

PHPackages © 2026

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