Define immutable data objects by extending the ImmutableDTO base class. Properties are initialized via constructor promotion.
Attribute-Driven Mapping
Use PHP attributes like CastWith, MapFrom, MapTo, and Hidden to control how data is hydrated, transformed, and serialized with minimal boilerplate.
Framework-Agnostic
Works in Laravel, Symfony, or plain PHP projects. Carapace is a lightweight library with no external dependencies, making it easy to integrate into any PHP 8.2+ project.
Strictly Typed
Leverage PHP's type system to create well-defined, predictable data structures. Carapace encourages type safety.
Simple, Expressive API
Create, hydrate, and transform DTOs with a clean, intuitive API. Carapace makes working with DTOs a pleasure, reducing boilerplate and increasing productivity.
Comprehensive Documentation
Detailed documentation with examples for all features. Learn how to use Carapace effectively and get the most out of your DTOs.