##Basic installation
You can install this package via composer:
composer require spatie/laravel-typescript-transformer
The package will automatically register a service provider.
You can publish the config file with:
php artisan vendor:publish --provider="Spatie\LaravelTypeScriptTransformer\TypeScriptTransformerServiceProvider"
This is the default content of the config file:
<?php
return [
'auto_discover_types' => [
app_path()
],
'collectors' => [
Spatie\TypeScriptTransformer\Collectors\DefaultCollector::class,
],
'transformers' => [
Spatie\LaravelTypeScriptTransformer\Transformers\SpatieStateTransformer::class,
Spatie\TypeScriptTransformer\Transformers\SpatieEnumTransformer::class,
Spatie\TypeScriptTransformer\Transformers\DtoTransformer::class,
],
'default_type_replacements' => [
DateTime::class => 'string',
DateTimeImmutable::class => 'string',
Carbon\CarbonImmutable::class => 'string',
Carbon\Carbon::class => 'string',
],
'output_file' => resource_path('types/generated.d.ts'),
'writer' => Spatie\TypeScriptTransformer\Writers\TypeDefinitionWriter::class,
'formatter' => null,
'transform_to_native_enums' => false,
];