Home - Grazulex/laravel-arc GitHub Wiki

🏠 Laravel Arc Wiki

Laravel Arc Logo

Elegant and modern Data Transfer Objects (DTOs) for Laravel

🎯 Welcome!

Welcome to the comprehensive documentation for Laravel Arc - the modern DTO package for Laravel that makes data handling elegant, type-safe, and developer-friendly.

🚀 Quick Navigation

📚 Getting Started

🔧 Core Features

🎨 Advanced Features

📖 Reference & Examples

🔄 Migration & Updates

📺 Try It Live!

Want to see Laravel Arc in action? Check out our Live Demo! It's an interactive showcase of Laravel Arc's key features:

  • 🎯 Real-time DTO creation and validation
  • 🔄 Live property transformations
  • 🎨 Advanced features in action
  • 💡 Code examples you can try immediately

Launch Demo →

🌟 What Makes Laravel Arc Special?

Direct Property Access

// No more getters/setters!
$user->name = 'John Doe';    // ✅ Direct assignment
echo $user->email;           // ✅ Direct access

🎯 Unified Property Syntax

// One attribute for all types - clean and consistent
#[Property(type: 'string', required: true, validation: 'email')]
public string $email;

#[Property(type: 'enum', class: UserStatus::class)]
public UserStatus $status;

#[Property(type: 'nested', class: AddressDTO::class)]
public AddressDTO $address;

🛡️ Automatic Validation

// Rules generated automatically from attributes!
$rules = UserDTO::rules();
// ['email' => 'required|string|email', 'name' => 'required|string']

🔄 Smart Transformations

// Transform data before casting
#[Property(type: 'string', transform: [TrimTransformer::class, LowercaseTransformer::class])]
public string $email;  // '  [email protected]  ' becomes '[email protected]'

📊 Current Version: v2.1.0

Latest Features:

  • 🔄 Transformation Pipeline System - Pre-process data with built-in transformers
  • 🔍 Auto-Discovery Relations - Automatic Eloquent relation detection
  • 🛡️ Smart Validation Rules - Intelligent pattern-based validation
  • 🔧 Debug & Analysis Tools - dto:analyze and dto:validate commands

🎫 Quick Examples

Basic DTO

class UserDTO extends LaravelArcDTO {
    #[Property(type: 'string', required: true, validation: 'max:255')]
    public string $name;
    
    #[Property(type: 'string', required: true, validation: 'email')]
    public string $email;
}

$user = new UserDTO(['name' => 'John', 'email' => '[email protected]']);
echo $user->name; // John

Advanced DTO with Relations

class OrderDTO extends LaravelArcDTO {
    #[Property(type: 'nested', class: UserDTO::class)]
    public UserDTO $customer;
    
    #[Property(type: 'collection', class: ProductDTO::class)]
    public array $items;
    
    #[Property(type: 'enum', class: OrderStatus::class)]
    public OrderStatus $status;
}

🤝 Community & Support

📋 Requirements

Requirement Version
PHP 8.3+
Laravel 12+
Carbon 3.10+

Ready to get started?Quick Start Guide

Need help with migration?Migration from v1 to v2

Looking for examples?Examples Gallery

⚠️ **GitHub.com Fallback** ⚠️