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.
Initial release of OI Laravel TypeScript Generator - a comprehensive Laravel package that automatically generates TypeScript interfaces from Eloquent models.
_count fields for relationshipsBuilt with clean architecture principles and separation of concerns:
Eloquent: Facade for model analysis and schema generationModelDiscovery: Discovers all Eloquent models in the applicationTypeExtractor: Extracts type information from model propertiesRelationshipResolver: Detects and extracts relationship metadataCastTypeResolver: Resolves custom Laravel casts to TypeScript typesDataObjectAnalyzer: Analyzes PHP DataObject classesPhpToTypeScriptConverter: Converts PHP types to TypeScriptSchemaBuilder: Orchestrates complete schema buildingConvert: Main orchestrator coordinating TypeScript generationTypeScriptTypeConverter: Handles schema to TypeScript type conversionDataObjectProcessor: Processes PHP DataObjects and generates interfacesModelInterfaceGenerator: Generates TypeScript interfaces for modelsImportManager: Manages TypeScript import statementsJsonLdGenerator: Generates JSON-LD support interfacesphp artisan oi:gen-ts - Generate TypeScript interfacesphp artisan oi:gen-ts --watch - Watch mode for automatic regenerationoutput_path - Custom output path for generated TypeScriptwith_counts - Include relationship count fieldswith_json_ld - Enable JSON-LD supportsave_schema - Save intermediate schema.json for debuggingprops_with_types - Define specific types for propertiescustom_props - Add custom properties to modelsHow can I help you explore Laravel packages today?