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.
- 🔧 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
composer require cleaniquecoders/traitifyuse 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 Home - Complete documentation index
- Getting Started - Installation and setup
- Architecture - System design and patterns
- Traits Reference - All available traits
- Generators - Customizable value generation
- Configuration - Configuration options
- Examples - Real-world usage examples
- Advanced - Extend and customize
use InteractsWithUuid;
protected $uuid_column = 'id'; // Use UUID as primary keyuse InteractsWithToken;
protected $tokenGeneratorConfig = [
'length' => 64,
'prefix' => 'sk_',
'pool' => 'hex',
];use InteractsWithSlug;
protected $slugGeneratorConfig = [
'unique' => true,
'max_length' => 100,
];composer test| 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 |
Contributions are welcome! Please see CONTRIBUTING for details.
If you discover any security issues, please review our security policy.
Please see CHANGELOG for recent changes.
The MIT License (MIT). Please see License File for more information.