PHPackages                             cline/data - 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. cline/data

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

cline/data
==========

Extended validation attributes, casts, transformers, and type utilities for spatie/laravel-data

1.0.1(7mo ago)073MITPHPPHP ^8.4.0CI failing

Since Oct 19Pushed 4mo agoCompare

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

READMEChangelog (2)Dependencies (15)Versions (3)Used By (0)

[![GitHub Workflow Status](https://camo.githubusercontent.com/e094ee38900a1f91e40f7a0c59eb550e67024c73ecf70680328de72dcad2b50f/68747470733a2f2f6769742e636c696e652e73682f6661757374627269616e2f646174612f616374696f6e732f776f726b666c6f77732f7175616c6974792d6173737572616e63652e79616d6c2f62616467652e737667)](https://git.cline.sh/faustbrian/data/actions)[![Latest Version on Packagist](https://camo.githubusercontent.com/67614c52e717c758686f9ab90206a14ef6bbde0e4e175be5a8b219de4f76eef8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636c696e652f646174612e737667)](https://packagist.org/packages/cline/data)[![Software License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/5d45ff6f6f909345990ecc1124b3fd6848c31a6c2662d882abfcc7fa02d5cb06/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c696e652f646174612e737667)](https://packagist.org/packages/cline/data)

---

This library provides extended validation attributes, casts, transformers, and type utilities for [spatie/laravel-data](https://github.com/spatie/laravel-data). It enhances the powerful data transfer object pattern with additional validation rules, type conversions, and utilities designed for Laravel 11+ with PHP 8.4+.

Requirements
------------

[](#requirements)

> **Requires [PHP 8.4+](https://php.net/releases/) and [Laravel 11+](https://laravel.com/docs/11.x)**
>
> **Requires [spatie/laravel-data 4.18+](https://spatie.be/docs/laravel-data/v4/introduction)**

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

[](#installation)

```
composer require cline/data
```

Documentation
-------------

[](#documentation)

- **[Validation Attributes](cookbook/validation-attributes.md)** - Comprehensive conditional and relational validation rules
- **[Casts and Transformers](cookbook/casts-and-transformers.md)** - Type conversion and data transformation utilities
- **[Type Utilities](cookbook/type-utilities.md)** - Type coercion and conversion utilities (StringLike, BooleanLike, NumberLike)
- **[Examples](cookbook/examples.md)** - Real-world usage examples and patterns

Quick Start
-----------

[](#quick-start)

### Using Validation Attributes

[](#using-validation-attributes)

```
use Cline\Data\Attributes\Validation\{PresentIf, MissingIf};
use Spatie\LaravelData\Data;

class OrderData extends Data
{
    public function __construct(
        #[PresentIf('type', 'premium')]
        public ?string $upgradeOption = null,

        #[MissingIf('automatic_renewal', true)]
        public ?int $renewalDays = null,
    ) {}
}
```

### Using Casts and Transformers

[](#using-casts-and-transformers)

```
use Cline\Data\Casts\{TrimCast, UpperCaseCast, NumberLikeCast};
use Spatie\LaravelData\Data;

class UserData extends Data
{
    public function __construct(
        #[TrimCast, UpperCaseCast]
        public string $name,

        #[NumberLikeCast]
        public int $accountId,
    ) {}
}
```

### Using Type Utilities

[](#using-type-utilities)

```
use Cline\Data\Types\{StringLike, BooleanLike, NumberLike};

// Coerce values to appropriate types
$stringValue = StringLike::coerce('hello');
$boolValue = BooleanLike::coerce('true');
$numberValue = NumberLike::coerce('42.5');
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please use the [GitHub security reporting form](https://git.cline.sh/faustbrian/data/security) rather than the issue queue.

Credits
-------

[](#credits)

- [Brian Faust](https://git.cline.sh/faustbrian)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License. Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance70

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

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

2

Last Release

211d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22145591?v=4)[Brian Faust](/maintainers/faustbrian)[@faustbrian](https://github.com/faustbrian)

---

Top Contributors

[![faustbrian](https://avatars.githubusercontent.com/u/22145591?v=4)](https://github.com/faustbrian "faustbrian (6 commits)")

---

Tags

spatielaravelvalidationdatalaravel-datadata-transfer-objectdtotypestransformerscasts

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cline-data/health.svg)

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

###  Alternatives

[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

759569.4k13](/packages/wendelladriel-laravel-validated-dto)[spatie/laravel-data

Create unified resources and data transfer objects

1.8k28.9M627](/packages/spatie-laravel-data)[yorcreative/laravel-argonaut-dto

Argonaut is a lightweight Data Transfer Object (DTO) package for Laravel that supports nested casting, recursive serialization, and validation out of the box. Ideal for service layers, APIs, and clean architecture workflows.

1062.8k1](/packages/yorcreative-laravel-argonaut-dto)[basillangevin/laravel-data-json-schemas

Transforms Spatie Data objects into JSON Schemas with built-in validation

1312.2k1](/packages/basillangevin-laravel-data-json-schemas)[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

15828.6k](/packages/relaticle-custom-fields)[event4u/data-helpers

Framework-agnostic PHP library for data mapping, DTOs and utilities. Includes DataMapper, SimpleDto/LiteDto, DataAccessor/Mutator/Filter and helper classes (MathHelper, EnvHelper, etc.). Works with Laravel, Symfony/Doctrine or standalone PHP.

1421.5k](/packages/event4u-data-helpers)

PHPackages © 2026

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