Skip to content

Configuration Reference

A complete reference of every option in config/ts-publish.php, grouped by feature.

General Settings

Config KeyTypeDefaultDescription
run_after_migratebooltrueRe-publish types after running migrations
output_to_filesbooltrueWrite generated TypeScript to .ts files
output_directorystringresources/js/types/dataDirectory where TypeScript files are written
namespace_strip_prefixstring''Strip this prefix from namespaces in modular output
timestamps_as_dateboolfalseMap date/datetime/timestamp to Date instead of string
custom_ts_mappingsarray[]Override or extend PHP-to-TypeScript type mappings
ts_extends.modelsarray[]Global extends clauses for all models
ts_extends.resourcesarray[]Global extends clauses for all resources
ts_extends.form_requestsarray[]Global extends clauses for all form requests
ts_extends.broadcast_eventsarray[]Global extends clauses for all broadcast events
barrel_writer_classstringBarrelWriterClass that writes barrel index.ts files

Models (models.*)

Config KeyTypeDefaultDescription
models.enabledbooltrueEnable or disable model publishing
models.namespacestring'models'Namespace label used in the global declaration file
models.relationship_casestring'snake'Case style for relationships: snake, camel, or pascal
models.nullable_relationsbooltrueAppend | null to singular relation types based on smart detection
models.relation_nullability_maparray[]Override nullability strategy per relation type
models.templatestringlaravel-ts-publish::model-splitBlade template for model TypeScript output
models.includedarray[]Only publish these models (empty = all)
models.excludedarray[]Exclude these models from publishing
models.additional_directoriesarray[]Extra directories to search for models
models.collector_classstringModelsCollectorDiscovers PHP model classes
models.generator_classstringModelGeneratorOrchestrates transforming and writing
models.transformer_classstringModelTransformerConverts PHP class into TypeScript data
models.writer_classstringModelWriterWrites TypeScript model files

Enums (enums.*)

Config KeyTypeDefaultDescription
enums.enabledbooltrueEnable or disable enum publishing
enums.namespacestring'enums'Namespace label used in the global declaration file
enums.method_casestring'camel'Case style for enum methods: snake, camel, or pascal
enums.auto_include_methodsboolfalseInclude all public non-static enum methods without attributes
enums.auto_include_static_methodsboolfalseInclude all public static enum methods without attributes
enums.metadata_enabledbooltrueInclude _cases, _methods, _static metadata on enums
enums.use_tolki_packagebooltrueWrap enums in defineEnum() from @tolki/ts
enums.templatestringlaravel-ts-publish::enumBlade template for enum TypeScript output
enums.includedarray[]Only publish these enums (empty = all)
enums.excludedarray[]Exclude these enums from publishing
enums.additional_directoriesarray[]Extra directories to search for enums
enums.collector_classstringEnumsCollectorDiscovers PHP enum classes
enums.generator_classstringEnumGeneratorOrchestrates transforming and writing
enums.transformer_classstringEnumTransformerConverts PHP enum into TypeScript data
enums.writer_classstringEnumWriterWrites TypeScript enum files

Resources (resources.*)

Config KeyTypeDefaultDescription
resources.enabledbooltrueEnable or disable resource publishing
resources.namespacestring'resources'Namespace label used in the global declaration file
resources.templatestringlaravel-ts-publish::resourceBlade template for resource TypeScript output
resources.includedarray[]Only publish these resources (empty = all)
resources.excludedarray[]Exclude these resources from publishing
resources.additional_directoriesarray[]Extra directories to search for resources
resources.collector_classstringResourcesCollectorDiscovers PHP resource classes
resources.generator_classstringResourceGeneratorOrchestrates transforming and writing
resources.transformer_classstringResourceTransformerConverts PHP resource into TypeScript data
resources.writer_classstringResourceWriterWrites TypeScript resource files

Globals (globals.*)

Config KeyTypeDefaultDescription
globals.enabledboolfalseGenerate a global.d.ts namespace file
globals.output_directory?stringnullDirectory for the global declaration file
globals.filenamestringlaravel-ts-global.d.tsFilename for the global declaration file
globals.templatestringlaravel-ts-publish::globalsBlade template for global declaration output
globals.writer_classstringGlobalsWriterWrites global declaration file

JSON (json.*)

Config KeyTypeDefaultDescription
json.enabledboolfalseOutput all definitions as a JSON file
json.filenamestringlaravel-ts-definitions.jsonFilename for the JSON output
json.output_directory?stringnullDirectory for the JSON output
json.writer_classstringJsonWriterWrites JSON definitions file

Watcher (watcher.*)

Config KeyTypeDefaultDescription
watcher.enabledbooltrueOutput collected PHP file paths as JSON (for file watchers)
watcher.filenamestringlaravel-ts-collected-files.jsonFilename for the collected files JSON
watcher.output_directory?stringnullDirectory for the collected files JSON
watcher.writer_classstringWatcherJsonWriterWrites collected files JSON for watchers

Routes (routes.*)

Config KeyTypeDefaultDescription
routes.enabledbooltrueEnable or disable route publishing
routes.method_casingstring'camel'Case style for route method names
routes.output_path?stringnullCustom output path for route files
routes.onlyarray[]Only publish these routes (empty = all)
routes.exceptarray[]Exclude these routes from publishing
routes.exclude_middlewarearray[]Exclude routes with these middleware
routes.only_namedboolfalseOnly publish named routes
routes.collector_classstringRoutesCollectorDiscovers PHP routes
routes.generator_classstringRouteGeneratorOrchestrates transforming and writing
routes.transformer_classstringRouteTransformerConverts routes into TypeScript data
routes.writer_classstringRouteWriterWrites TypeScript route files
routes.templatestringlaravel-ts-publish::routeBlade template for route output

Form Requests (form_requests.*)

Config KeyTypeDefaultDescription
form_requests.enabledbooltrueEnable or disable form request publishing
form_requests.namespacestring'form-requests'Namespace label used in the global declaration file
form_requests.templatestringlaravel-ts-publish::form-requestBlade template for form request TypeScript output
form_requests.output_directory?stringnullCustom output directory for form request files
form_requests.includedarray[]Only publish these form requests (empty = all)
form_requests.excludedarray[]Exclude these form requests from publishing
form_requests.additional_directoriesarray[]Extra directories to search for form requests
form_requests.collector_classstringFormRequestsCollectorDiscovers PHP FormRequest classes
form_requests.generator_classstringFormRequestGeneratorOrchestrates transforming and writing
form_requests.transformer_classstringFormRequestTransformerConverts PHP FormRequest into TypeScript data
form_requests.writer_classstringFormRequestWriterWrites TypeScript form request files

Broadcast Channels (broadcast_channels.*)

Config KeyTypeDefaultDescription
broadcast_channels.enabledbooltrueEnable or disable broadcast channel publishing
broadcast_channels.filenamestringbroadcast-channels.tsFilename for the generated channels file
broadcast_channels.templatestringlaravel-ts-publish::broadcast-channelsBlade template for the channels output
broadcast_channels.output_directory?stringnullCustom output directory for the channels file
broadcast_channels.collector_classstringBroadcastChannelsCollectorDiscovers registered channel names
broadcast_channels.writer_classstringBroadcastChannelsWriterWrites the broadcast-channels.ts file

Broadcast Events (broadcast_events.*)

Config KeyTypeDefaultDescription
broadcast_events.enabledbooltrueEnable or disable broadcast event publishing
broadcast_events.index_filenamestringbroadcast-events.tsFilename for the combined index file
broadcast_events.index_templatestringlaravel-ts-publish::broadcast-events-indexBlade template for the index file
broadcast_events.templatestringlaravel-ts-publish::broadcast-eventBlade template for each per-event interface file
broadcast_events.output_directory?stringnullCustom output directory for event files
broadcast_events.includedarray[]Only publish these event classes (empty = all)
broadcast_events.excludedarray[]Exclude these event classes from publishing
broadcast_events.additional_directoriesarray[]Extra directories to search for event classes
broadcast_events.collector_classstringBroadcastEventsCollectorDiscovers ShouldBroadcast classes
broadcast_events.generator_classstringBroadcastEventGeneratorOrchestrates transforming and writing
broadcast_events.transformer_classstringBroadcastEventTransformerConverts a PHP event class into TypeScript data
broadcast_events.writer_classstringBroadcastEventWriterWrites per-event TypeScript files
broadcast_events.index_writer_classstringBroadcastEventsIndexWriterWrites the combined index file
broadcast_events.echo_augmentation.enabledbooltrueGenerate the Echo module augmentation file
broadcast_events.echo_augmentation.echo_package?stringnullnpm package to augment (auto-detected from package.json when null)
broadcast_events.echo_augmentation.filenamestringecho-broadcast-events.d.tsFilename for the Echo augmentation file
broadcast_events.echo_augmentation.templatestringlaravel-ts-publish::echo-broadcast-eventsBlade template for the Echo augmentation file
broadcast_events.echo_augmentation.output_directory?stringnullCustom output directory for the Echo augmentation file
broadcast_events.echo_augmentation.writer_classstringBroadcastEventsEchoWriterWrites the Echo augmentation file

Inertia (inertia.*)

Config KeyTypeDefaultDescription
inertia.enabledbooltrueEnable or disable Inertia shared-data and page-prop analysis
inertia.inertia_middleware_path?stringnullDirectory to search for the HandleInertiaRequests middleware (defaults to app_path())
inertia.augmentation_filenamestringinertia-config.d.tsFilename for the generated module augmentation file
inertia.output_directory?stringnullCustom output directory (falls back to routes.output_directory, then the global output_directory)
inertia.component_casingstring'camel'Casing style for derived page-prop export names (used by the per-route page-props feature — see Routing)
inertia.ui_table_package?stringnullnpm package used for InertiaUI Table integration (used by the per-route page-props feature)

Vite Environment (vite_env.*)

Config KeyTypeDefaultDescription
vite_env.enabledbooltrueEnable Vite environment type generation
vite_env.filenamestringvite-env.d.tsFilename for the Vite env declaration file
vite_env.output_directory?stringnullCustom output directory for the Vite env file
vite_env.source_file?stringnullSource .env file (defaults to .env, falls back to .env.example)

Cache Generation (cache.*)

Config KeyTypeDefaultDescription
cache.enabledbooltrueSkip re-generating unchanged classes after the first run
cache.store?stringnullnull = file cache under directory; or a Laravel cache store name
cache.directorystringstorage/framework/cache/ts-publishDirectory for the file-based cache manifest
cache.key?stringnullHMAC signing key for the cache (file and store); defaults to app.key

See the Cache Generation documentation for the full behavior, busting rules, and the --fresh flag.

NOTE

Pipeline class config keys (*.collector_class, *.generator_class, *.transformer_class, *.writer_class) are included in their respective tables above. See Customizing the Pipeline for the full contract each class must implement.

See the full configuration file for detailed comments on each option.

Released under the MIT License.