PHPackages                             nitier/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. [Database &amp; ORM](/categories/database)
4. /
5. nitier/datatype

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

nitier/datatype
===============

Data type helpers

0.1.0(1y ago)015MITPHPPHP &gt;=8.3

Since Nov 27Pushed 1y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

DataType Library
================

[](#datatype-library)

A PHP library for handling various data types with built-in validation for format, range, and nullability.

📦 Installation
--------------

[](#-installation)

Requires **PHP 8.0+**. Install the package via `Composer`:

```
composer require nitier/datatype
```

🛠 Supported Data Types
----------------------

[](#-supported-data-types)

- **Text Types:** `TextType`, `VarcharType`, `TinyTextType`, `MediumTextType`, `LongTextType`
- **Temporal Types:** `DateType`, `TimeType`, `DatetimeType`, `TimestampType`, `YearType`
- **Numeric Types:** `IntType`, `FloatType`, `DecimalType`, `TinyIntType`, `MediumIntType`, `SmallIntType`

🚀 Usage Examples
----------------

[](#-usage-examples)

### Text Types

[](#text-types)

#### `VarcharType`

[](#varchartype)

```
use Nitier\DataType\Type\VarcharType;

$varchar = new VarcharType(length: 100);
$varchar->setValue('Example text');
echo $varchar->getValue(); // Output: Example text

try {
    $varchar->setValue(str_repeat('A', 101));
} catch (\InvalidArgumentException $e) {
    echo $e->getMessage(); // Error: length exceeded
}
```

### Temporal Types

[](#temporal-types)

#### `DateType`

[](#datetype)

```
use Nitier\DataType\Type\DateType;

$date = new DateType();
$date->setValue('2023-11-28');
echo $date->getValue(); // Output: 2023-11-28

try {
    $date->setValue('28.11.2023');
} catch (\InvalidArgumentException $e) {
    echo $e->getMessage(); // Error: invalid format
}
```

📂 Project Structure
-------------------

[](#-project-structure)

```
DataType/
├── src/
│   └── Type/
│       ├── TextType.php
│       ├── VarcharType.php
│       ├── DateType.php
│       ├── DatetimeType.php
│       └── ...
├── tests/
└── composer.json

```

🧪 Running Tests
---------------

[](#-running-tests)

Ensure **PHPUnit** is installed:

```
composer require --dev phpunit/phpunit
```

Run tests:

```
composer test
```

📝 License
---------

[](#-license)

Licensed under the **MIT License**. See `LICENSE` for details.

🤝 Contributions
---------------

[](#-contributions)

Contributions are welcome via **pull requests** or **issues**. Let's make this library better together!

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Total

4

Last Release

536d ago

### Community

Maintainers

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

---

Top Contributors

[![Nitier](https://avatars.githubusercontent.com/u/185420306?v=4)](https://github.com/Nitier "Nitier (10 commits)")

---

Tags

databasedatatypesmariadbmysqlphptype

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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