https://github.com/ph-7/php-type-names
👉 "PHP type names" contains the list of constants for all PHP data types, to avoid hardcoding them 👌
https://github.com/ph-7/php-type-names
constants datatypes magic-numbers magicnumbers php php-constants type-name type-names types
Last synced: about 1 month ago
JSON representation
👉 "PHP type names" contains the list of constants for all PHP data types, to avoid hardcoding them 👌
- Host: GitHub
- URL: https://github.com/ph-7/php-type-names
- Owner: pH-7
- License: mit
- Created: 2022-01-06T20:58:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-06T09:23:03.000Z (over 2 years ago)
- Last Synced: 2025-04-09T20:05:50.884Z (about 1 month ago)
- Topics: constants, datatypes, magic-numbers, magicnumbers, php, php-constants, type-name, type-names, types
- Language: PHP
- Homepage: https://pierrehenry.hashnode.dev
- Size: 35.2 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# PHP type names ⚡️
*Get all valid PHP type names with constants* ✅
## 📄 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
* [PHP 7.3](https://www.php.net/releases/7_3_0.php) or newer.
## ⚙️ Installation
Install it easily with [Composer](https://getcomposer.org/doc/00-intro.md)
```bash
composer require ph-7/datatype
```## 🤠 Example
```php
require_once __DIR__ . '/vendor/autoload.php';use PH7\Datatype\Type;
$id = settype($_GET['id'], Type::STRING);
$name = settype($inputName, Type::STRING);
```## 😋 Who cooked it?
[](https://ph7.me "Pierre-Henry Soria personal website")
**[Pierre-Henry Soria](https://ph7.me)**, a highly passionate, zen & pragmatic software engineer 😊
[![@phenrysay][twitter-image]](https://twitter.com/phenrysay) [![pH-7][github-image]](https://github.com/pH-7)
## 📺 The Video
[![Watch the video][video-thumbnail]](https://youtu.be/9v9g722dulE?t=453)
👉 **[Watch on YouTube](https://youtu.be/9v9g722dulE?t=453)** 👈
## ⚖️ License
**PHP type names** is generously distributed under the *[MIT](https://opensource.org/licenses/MIT)*.
[twitter-image]: https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white
[github-image]: https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white
[video-thumbnail]: https://i1.ytimg.com/vi/9v9g722dulE/sddefault.jpg