spatie/laravel-typescript-transformer
Convert PHP classes, enums, and more into TypeScript types automatically in Laravel. Mark PHP code with attributes, handle complex types and generics, and generate TS-friendly definitions (and even functions) to keep frontend types in sync.
spatie/laravel-typescript-transformer converts PHP types into clean, maintainable TypeScript definitions for Laravel apps. Annotate classes (e.g., #[TypeScript]), enums, and more, then generate matching TS types to keep frontend and backend contracts in sync.
It supports advanced typing scenarios—nullable types, unions, generics, and even generating TypeScript functions—making it a solid choice for teams sharing models across PHP and TS.
type definitionsHow can I help you explore Laravel packages today?