Runtype
TypeScript interfaces from your Laravel models and resources, generated with one Artisan command.
- Made by
- Vagebond
- Type
- Open source
- Stack
- PHP, Laravel, TypeScript

From resource to type
Runtype reads the resources in app/Http/Resources and writes one TypeScript type for each of them. A conditional attribute becomes an optional property.
php artisan runtype:generateModels and resources
Runtype has a converter for models, a converter for resources and a default converter for all other classes. The config file says which converter to use for each class.
'converters' => [
JsonResource::class => ResourceConverter::class,
Model::class => ModelConverter::class,
],Extend it
Write your own converter. Add a modifier to set the properties that Runtype cannot detect, or replace a PHP type, such as DateTime, with a TypeScript type.
Stack
- PHP
- Laravel
- TypeScript
- Pest