Skip to main content
Sometimes you want to change the name of a property in the transformed payload. You can do this with attributes:
Transformed output:

Class-Level Mapping

Change all property names in a data object to snake_case:

Input and Output Mapping

Use the MapName attribute to combine input and output property name mapping:

Global Name Mapping

Set a default name mapping strategy for all data objects in config/data.php:
Now all data objects will automatically map property names to snake_case in the output:

Available Mappers

The package includes several built-in mappers:
  • SnakeCaseMapper - Converts to snake_case
  • CamelCaseMapper - Converts to camelCase
  • StudlyCaseMapper - Converts to StudlyCase
  • KebabCaseMapper - Converts to kebab-case
For a complete list of available property mappers, see the advanced usage documentation.