spatie/typescript-transformer
Automatically generate TypeScript definitions from your PHP/Laravel code. spatie/typescript-transformer scans classes and types, then outputs .d.ts files so your frontend stays in sync with backend models, DTOs and enums with minimal manual typing.
Besides the transformer() method which appends transformers to the end of the list, the configuration provides two additional methods for more control:
Prepending transformers — adds transformers to the beginning of the list, useful when your transformer should take priority over others:
$config->prependTransformer(new HighPriorityTransformer());
Replacing transformers — swaps an existing transformer for a different one, useful within extensions to override a default transformer:
$config->replaceTransformer(
AttributedClassTransformer::class,
new MyCustomClassTransformer()
);
How can I help you explore Laravel packages today?