-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
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.
- π 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
composer require grazulex/laravel-arc
# 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
php artisan dto:generate user.yaml
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();
- Installation & Setup - Complete installation and configuration
- Your First DTO - Create your first DTO in 5 minutes
- Understanding YAML Structure - Learn the YAML schema basics
- Field Types - All 65+ supported field types
- Field Transformers - Data transformation capabilities
- Behavioral Traits - Timestamps, UUIDs, soft deletes
- Generated DTO Structure - Understanding generated code
- Nested DTOs - Working with complex data structures
- Collections - Managing arrays of DTOs
- Artisan Commands - Complete command reference
- Configuration - Package configuration options
- API Integration Example - Real-world API usage
- Complete Examples - All examples in one place
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
- New to Laravel Arc? Start with Installation & Setup
- Want to dive in? Try Your First DTO
- Need examples? Check API Integration Example
- Advanced user? Explore Field Transformers
Laravel Arc - From YAML to Type-Safe DTOs in seconds π
Laravel Arc - Generate Type-Safe DTOs from YAML Definitions
π Home | π Get Started | π Examples | βοΈ Config
From YAML to Type-Safe Code - Made with β€οΈ for the Laravel community
π Home
- π Understanding YAML Structure
- π·οΈ Field Types
- π Field Transformers
- π Behavioral Traits
YAML β DTO β Type-Safe Code
Laravel Arc transforms your YAML definitions into powerful PHP DTOs with automatic validation, field transformers, and behavioral traits.
- π Get Started - Create your first DTO in 5 minutes
- π All Examples - Copy-paste ready examples
- β‘ Commands - CLI reference