cleaniquecoders/traitify 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

cleaniquecoders/traitify

最新稳定版本:1.3.1

Composer 安装命令:

composer require cleaniquecoders/traitify

包简介

Traitify is a Laravel package designed to streamline and enhance your development process by providing a collection of reusable traits and contracts.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel package that streamlines development with reusable traits, contracts, and a powerful value generator system. Reduce boilerplate, standardize behavior, and enhance your models with automatic UUID, token, and slug generation.

✨ Features

  • ???? 11 Reusable Traits - UUID, Token, Slug, Meta, User, API, Search, and more
  • ???? Customizable Generators - Flexible token, UUID, and slug generation
  • ⚙️ Three-Tier Configuration - Model → Config → Default resolution
  • ???? Extensible Architecture - Create custom generators easily
  • ???? Zero Configuration - Works out of the box with sensible defaults
  • 100% Tested - Comprehensive test coverage with Pest PHP

???? Installation

composer require cleaniquecoders/traitify

???? Quick Start

use CleaniqueCoders\Traitify\Concerns\InteractsWithUuid;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use InteractsWithUuid;

    // UUID automatically generated on creation
}
$post = Post::create(['title' => 'Hello World']);
echo $post->uuid; // 9d9e8da7-78c3-4c9d-9f5e-5c8e4a2b1d3c

???? Documentation

???? Popular Use Cases

Auto-Generate UUIDs

use InteractsWithUuid;

protected $uuid_column = 'id'; // Use UUID as primary key

Secure API Tokens

use InteractsWithToken;

protected $tokenGeneratorConfig = [
    'length' => 64,
    'prefix' => 'sk_',
    'pool' => 'hex',
];

SEO-Friendly Slugs

use InteractsWithSlug;

protected $slugGeneratorConfig = [
    'unique' => true,
    'max_length' => 100,
];

???? Testing

composer test

???? Available Traits

Trait Purpose
InteractsWithUuid Auto-generate UUIDs
InteractsWithToken Generate secure tokens
InteractsWithSlug Create URL-friendly slugs
InteractsWithMeta Manage JSON metadata
InteractsWithUser Auto-assign user relationships
InteractsWithApi API response formatting
InteractsWithSearchable Full-text search
InteractsWithDetails Eager load relationships
InteractsWithEnum Enum helper methods
InteractsWithResourceRoute Resource route generation
InteractsWithSqlViewMigration SQL view migrations

???? Contributing

Contributions are welcome! Please see CONTRIBUTING for details.

???? Security

If you discover any security issues, please review our security policy.

???? Changelog

Please see CHANGELOG for recent changes.

???? Credits

???? License

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

统计信息

  • 总下载量: 4.79k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 18
  • 点击次数: 1
  • 依赖项目数: 15
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固