diephp/laravel-resources-typescript
JsonResource pattern without forcing a full DTO migration, lowering the barrier to adoption.Use This When:
JsonResource for API responses.ArrayShape, or public properties.Look Elsewhere When:
toArray()).spatie/laravel-json-api or OpenAPI tools).darkaonline/l5-swagger or zircote/swagger-php).*"This package eliminates a major friction point in our full-stack development workflow. By automatically generating TypeScript types from Laravel’s JsonResource classes, we can:
It’s a lightweight, zero-config solution for teams already using Laravel and TypeScript. The cost? Almost nothing—just a Composer package. The ROI? Faster iterations, fewer errors, and happier developers."*
*"This package solves the ‘type mismatch’ problem between Laravel and TypeScript by:
JsonResource classes, including:
@var, @property).#[ArrayShape]).$fillable fields.toArray() responses (if structured predictably).any safely for ambiguous cases, so it never breaks your build.Why use this over alternatives?
HasMany, BelongsTo) better than generic OpenAPI tools.Trade-offs:
Next Steps:
composer require diephp/laravel-resources-typescript).php artisan resources:typescript to generate types.import type { UserResource } from './generated').Let’s prototype this on [Project X] to validate the time savings!"*
How can I help you explore Laravel packages today?