spatie/laravel-data
Define rich, typed data objects once and use them for requests, validation, API resources/transformers, and TypeScript definitions. Create from arrays/requests/models, apply rules automatically, and transform only what’s needed with lazy properties.
php artisan data:cache-structures) mitigates this in production.symfony/serializer).FormRequest validation with data object type hints + custom casts.ApiResource with Data objects for API responses.php artisan data:cache-structures in CI/CD pipelines (e.g., post-deploy).WithData trait to retroactively add data object support to existing models/requests.spatie/array-to-object).WithData trait.UserData, OrderData).ApiResource with data objects for API responses.rules() methods to type hints + custom casts, making validation rules easier to maintain.dd($dataObject) to inspect structure and validation errors.DATA_OBJECTS.md file listing all data objects and their purposes.data:cache-structures) ensures minimal runtime overhead. Benchmark with 10K+ data objects if scaling horizontally.try-catch blocks around data object creation to handle Uncastable exceptions gracefully.php artisan data:cache-structures --force
StoreRequest to StoreData).How can I help you explore Laravel packages today?