oi-lab/oi-laravel-ts
Generates TypeScript interfaces from Laravel Eloquent models, including relationships, casts, PHPDoc types, and DataObjects. Supports watch mode, namespace filtering, UUID/ULID key typing, and optional JSON-LD output.
$fillable, $casts). Custom model traits or non-standard attributes may require configuration tweaks.excluded_namespaces or extended_namespaces could lead to broken imports or missing types in generated files.custom_props?.ts file be shared?User, Order) to validate output quality.excluded_namespaces to exclude third-party models initially.discover_related_models gradually to avoid generating excessive interfaces upfront.custom_props to handle edge cases before expanding to all models..d.ts files with generated interfaces.tsc, ESLint, Prettier).__construct with typed properties).composer require).php artisan vendor:publish).output_path and excluded_namespaces.php artisan oi:gen-ts to produce initial output.interfaces.ts for accuracy.custom_props or config as needed.--watch) for development.node_modules/@types or shared folder).config/oi-laravel-ts.php (e.g., adding new custom_props or adjusting excluded_namespaces).save_schema: true in config to inspect intermediate JSON schema for issues.discover_related_models is enabled or manually add missing models to custom_props.custom_props (e.g., email_verified_at: Date)..ts file is included in TypeScript’s include paths.multi-file output (if supported in future versions) to avoid giant .ts files.excluded_namespaces.| Scenario | Impact | Mitigation |
|---|---|---|
| Model schema changes | Broken TypeScript types | Enable watch mode or CI regeneration. |
| Custom cast misconfiguration | Incorrect TypeScript types | Use custom_props to override. |
| Frontend build breaks | Missing/incorrect interfaces | Version-control generated files. |
| PHP version incompatibility | Package fails to install/run | Pin PHP version in composer.json. |
config/oi-laravel-ts.php schema for the team..ts file.How can I help you explore Laravel packages today?