定制 cline/data 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cline/data

最新稳定版本:1.0.1

Composer 安装命令:

composer require cline/data

包简介

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

README 文档

README

GitHub Workflow Status Latest Version on Packagist Software License Total Downloads

This library provides extended validation attributes, casts, transformers, and type utilities for 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

Requires PHP 8.4+ and Laravel 11+

Requires spatie/laravel-data 4.18+

Installation

composer require cline/data

Documentation

Quick Start

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

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

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

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please use the GitHub security reporting form rather than the issue queue.

Credits

License

The MIT License. Please see License File for more information.

统计信息

  • 总下载量: 73
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-19