Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Typescript

Laravel Typescript Laravel Package

based/laravel-typescript

based/laravel-typescript generates TypeScript definitions from Laravel models, resources, and routes, keeping frontend and backend types in sync via artisan commands and configurable output.

View on GitHub
Deep Wiki
Context7

based/laravel-typescript turns your Laravel backend into TypeScript definitions automatically. Instead of hand-maintaining types for models, API resources, routes, and validation rules, run a single Artisan command and get type-safe, always-in-sync files your frontend can import.

  • Generates model and relationship types from Eloquent
  • Converts form requests and validation rules into TypeScript
  • Exposes routes with typed params and methods
  • Supports API resources, enums, and custom collectors
  • Extensible transformer pipeline with configurable output
Frequently asked questions about Laravel Typescript
How do I install based/laravel-typescript in a Laravel application?
Install it with Composer as a dev dependency and run the package's Artisan generation command. Before adopting it, verify the Composer constraints against your PHP and Laravel versions because the last release dates to 2021. Pin the exact package version rather than using a floating constraint.
Does based/laravel-typescript support Laravel 10, 11, or 12?
Support for Laravel 10, 11, and 12 is unproven in the provided evaluation. The package has had no release since 2021-07-25, so compatibility with modern PHP and Laravel versions should be tested in a short spike. Do not assume it works until you have generated types against your actual models and API responses.
What does based/laravel-typescript generate from Eloquent models?
It generates TypeScript interfaces from Laravel Eloquent models via an Artisan command. The package advertises coverage for relationships, casts, enums, and custom types. The evaluation cautions that generated interfaces may still miss accessors, appends, hidden or visible fields, nullability, dates, pagination wrappers, and model inheritance.
Is based/laravel-typescript actively maintained?
The evaluation treats it as effectively unmaintained: no release since 2021-07-25, 398 stars, and 0 dependents. Support is community-only with no SLA, and issue response is expected to be limited. Pin the version, assign an internal owner, and keep a fork contingency ready if it becomes part of your workflow.
Can I use based/laravel-typescript with Laravel API Resources or DTOs?
It is a weaker fit when API responses are shaped by Laravel API Resources, DTOs, or OpenAPI contracts. Model-derived interfaces may not match the actual wire format, so generated types could drift from what the frontend receives. Pair it with OpenAPI or a DTO/transformer layer for public or partner-facing APIs.
How are nullable fields, enums, dates, and custom casts represented in TypeScript?
The blurb says enums, casts, and custom types are covered, but the exact TypeScript representation must be verified in your own spike. Inspect the generated output for nullability, date handling, hidden fields, and custom cast behavior. Do not trust the types until you have diffed them against real JSON responses and existing hand-written types.
Is the generated TypeScript output deterministic and CI-friendly?
CI determinism and generated-file churn need validation before you standardize on this package. Generate types into a temporary directory in a branch and diff them to confirm stable output. If adopted, review and version-control the output or generate it reproducibly in CI with a drift check rather than relying on individual developer machines.
Can I exclude or group models when generating TypeScript interfaces?
The provided context does not confirm model exclusion or grouping options, so check the package's Artisan command options and README. If the feature is missing or insufficient, generate into a temporary directory and filter the output, or fork with minimal patches. Keep this decision inside a bounded pilot before expanding usage.
What are good alternatives to based/laravel-typescript for Laravel-to-TypeScript types?
Consider OpenAPI contracts, a DTO or transformer layer, or a maintained type-generation approach instead of relying on Eloquent model shapes alone. The package can still serve as a reference pattern for internal type generation. For public APIs, standardize on a contract-based approach that reflects the actual wire format.
Should I use based/laravel-typescript in production or for public APIs?
It is a dev-time code-generation utility, not a runtime dependency, so production risk is mainly inaccurate types and generated-file drift. It can be useful for internal Laravel plus TypeScript SPA types if a pilot proves the output accurate and stable. Avoid relying on it as an API contract system for public or partner-facing APIs.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core