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.
git push → typescript-transform → deploy).HasMany, BelongsTo relationships, custom accessors).Carbon → string vs. Date object).Adopt if:
Look elsewhere if:
#[Assert\Type] or TypeScript zod instead).Alternatives:
.d.ts files.laravel-graphql).json-schema-to-typescript for REST APIs without PHP classes."This package eliminates a major friction point between our Laravel backend and TypeScript frontend. Today, our teams spend hours manually syncing types—leading to bugs, delays, and technical debt. By automating this with spatie/typescript-transformer, we’ll:
"This solves a critical scalability bottleneck. Currently, our frontend and backend teams operate in silos due to manual type management. With this tool:
User and Order models in Q3, then expand to all critical domains. Setup effort: ~2 dev days; ROI: immediate productivity gains.""No more copy-pasting PHP types into TypeScript! This tool:
#[TypeScript]
class User { public int $id; public string $name; }
Into this TypeScript:
export type User = { id: number; name: string };
#[TypeScript] to classes you want to sync.
Try it on your next feature—it’s like having a type-safety superpower."How can I help you explore Laravel packages today?