Sometimes you want to change the name of a property in the transformed payload. You can do this with attributes:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/spatie/laravel-data/llms.txt
Use this file to discover all available pages before exploring further.
Class-Level Mapping
Change all property names in a data object to snake_case:Input and Output Mapping
Use theMapName attribute to combine input and output property name mapping:
Global Name Mapping
Set a default name mapping strategy for all data objects inconfig/data.php:
- Data Object
- Transformed Output
Available Mappers
The package includes several built-in mappers:SnakeCaseMapper- Converts to snake_caseCamelCaseMapper- Converts to camelCaseStudlyCaseMapper- Converts to StudlyCaseKebabCaseMapper- Converts to kebab-case
For a complete list of available property mappers, see the advanced usage documentation.