Skip to content
Jean-Marc Strauven edited this page Aug 6, 2025 · 4 revisions

πŸš€ Laravel Arc

A modern YAML-driven DTO generator for Laravel applications

Laravel Arc transforms your data structures into type-safe, validated PHP DTOs through simple YAML definitions. Define your data schemas in readable YAML files and let Laravel Arc generate powerful, feature-rich Data Transfer Objects with automatic validation, field transformers, and collection handling.

🌟 Why Laravel Arc?

  • πŸ“„ YAML-First: Define DTOs in simple, readable YAML files
  • πŸ”’ Type-Safe: Generate PHP 8.3+ classes with strict typing
  • βœ… Auto-Validation: Built-in Laravel validation from YAML definitions
  • πŸ”„ Field Transformers: Automatic data transformation (trim, slugify, normalize)
  • πŸ“Š Export Formats: Convert to JSON, XML, CSV, YAML, and more
  • 🎯 Behavioral Traits: Timestamps, UUIDs, soft deletes, and tagging
  • πŸ“¦ Collection Support: Fluent handling of DTO collections

⚑ Quick Start

1. Install the Package

composer require grazulex/laravel-arc

2. Create Your First YAML Definition

# resources/arc/user.yaml
header:
  class: UserDto
  namespace: App\DTOs

fields:
  name:
    type: string
    required: true
    max_length: 255
    
  email:
    type: email
    required: true
    unique: true
    
  age:
    type: integer
    min: 18
    max: 120

3. Generate Your DTO

php artisan dto:generate user.yaml

4. Use Your Generated DTO

use App\DTOs\UserDto;

// Create from array
$user = UserDto::from([
    'name' => 'John Doe',
    'email' => '[email protected]',
    'age' => 30
]);

// Access properties directly
echo $user->name; // "John Doe"
echo $user->email; // "[email protected]"

// Export to different formats
$json = $user->toJson();
$array = $user->toArray();

πŸ—ΊοΈ Documentation Guide

πŸš€ Getting Started

πŸ“š Core Concepts

πŸ”§ Advanced Features

βš™οΈ CLI & Configuration

πŸ“– Practical Examples

🎯 Key Concepts

YAML β†’ DTO Generation Flow:

YAML Definition β†’ Laravel Arc β†’ Generated DTO Class
     ↓                ↓              ↓
  Schema Rules   β†’  Validation   β†’  Type-Safe Code

Laravel Arc takes your YAML definitions and generates modern PHP classes that include:

  • Readonly properties for immutability
  • Automatic validation based on field rules
  • Type enforcement with PHP 8.3+ features
  • Collection methods for array handling
  • Export capabilities to multiple formats

🏁 What's Next?

  1. New to Laravel Arc? Start with Installation & Setup
  2. Want to dive in? Try Your First DTO
  3. Need examples? Check API Integration Example
  4. Advanced user? Explore Field Transformers

Laravel Arc - From YAML to Type-Safe DTOs in seconds πŸš€

πŸš€ Laravel Arc Wiki

🏠 Home

πŸš€ Getting Started

πŸ“š Core Concepts

πŸ—οΈ Advanced Features

βš™οΈ Configuration & CLI

🌐 Real-World Examples


🎯 Key Concepts

YAML β†’ DTO β†’ Type-Safe Code

Laravel Arc transforms your YAML definitions into powerful PHP DTOs with automatic validation, field transformers, and behavioral traits.

πŸ”— Quick Links

Clone this wiki locally