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

Typescript Generator Bundle Laravel Package

irontec/typescript-generator-bundle

Symfony bundle that generates TypeScript definitions from PHP classes, helping keep backend models and frontend types in sync. Automate interface generation for APIs and DTOs, improve IDE autocomplete, and reduce type duplication. Ideal for Symfony apps needing consistent frontend/backend contracts.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit The package is a build-time codegen utility that bridges Laravel/PHP domain types and a TypeScript front-end contract — a natural fit for Laravel apps using Inertia + Vue/React or a separate SPA consuming an API. The #[TypeScriptMe] PHP attribute is the notable architectural change in 1.0.0: it makes participation opt-in and colocated with the class it describes, which is materially better than config-driven or convention-only generation. It keeps the tool out of the request path, which is the right placement for a type generator.

Integration feasibility Low friction. Composer install, a generator command (now runnable from host or container), and an output directory inside the front-end source tree. Because adoption is per-class via attribute, this can be piloted on one bounded context without touching unrelated code. No runtime dependency is introduced into the application container.

Technical risk Moderate, concentrated in three areas:

  1. Maturity. 1.0.0 is the first stable cut. Release notes describe foundational fixes (TypeScriptBaseInterface fallback for unknown property types, a guard around package.json creation) rather than polish, which suggests the type-mapping surface is still being discovered. Maintainer count, release cadence, and issue responsiveness are unverified.
  2. Type fidelity at the boundary. The fallback to TypeScriptBaseInterface when a property type is unknown is a correctness escape hatch: it prevents generation from failing but can emit a widened/loose contract that silently diverges from the PHP truth. That is the failure mode most likely to reach production, because it fails quietly at the type level rather than loudly at build time.
  3. Ecosystem coupling. The generator appears to write into or expect a JS project root (the package.json guard). In monorepos or non-standard layouts this can either block generation or target the wrong location.

Unverified and material: coverage of backed enums, Collection/array generics, Carbon, Eloquent casts, accessors, and relations; reflection-only vs. schema-aware mapping; namespace/import emission.

Key questions

  • What is the supported PHP/Laravel version matrix, and is PHP 8.1+ required for attributes?
  • Does it map backed enums, nullable unions, generics/collections, and Carbon to precise TS types, or to widened aliases?
  • Is generation reflection-only, or does it consult casts/DB schema? How are Eloquent magic properties handled?
  • Is the output directory and package.json location configurable?
  • Is there a documented drift-detection story (regenerate in CI, fail on diff)?
  • License, maintainer responsiveness, and whether 1.0.0 implies a semver stability commitment on generated output shape.

Integration Approach

Stack fit Fits an existing Laravel + TypeScript front-end without restructuring. Container execution is a real operational win: it lets CI and Docker-based dev environments run the generator against a pinned PHP version, avoiding "works on my machine" type output.

Migration path Incremental and reversible. Start with a single module of DTOs/request payloads, annotate with #[TypeScriptMe], generate into a dedicated directory (e.g. resources/js/types/generated), and consume from there. Expand to Eloquent models only after the type-mapping rules are validated against real cases. Because nothing existing is rewritten, rollback is deleting the annotations and the generated folder.

Compatibility The attribute is additive, so there is no upgrade cost for current classes. However, the TypeScriptBaseInterface fix means regenerating after upgrade can change the shape of previously generated types for unknown properties — expect a diff in output and treat generated files as reviewable artifacts, not opaque build output. Pin the exact version and diff generated output on every bump.

Sequencing

  1. Pin 1.0.0 exactly in composer.json.
  2. Configure output path (and confirm where it expects package.json).
  3. Pilot: annotate one bounded context's DTOs.
  4. Wire the generator into CI running inside the container image.
  5. Add a drift check: regenerate, fail the build on an unclean git diff of the generated folder.
  6. Expand to models/enums once mapping behavior is confirmed.
  7. Document conventions (what gets annotated, where output lives, never hand-edit generated files).

Operational Impact

Maintenance Low steady-state cost; the tool is a one-shot codegen step, not a runtime component. The maintenance burden is upgrade risk, not operational load: changes to output shape between versions are effectively breaking changes for the front-end even within semver. Mitigate with exact version pinning and generated-output diffs in review.

Support Community open-source with no vendor SLA. This needs a named internal owner and an explicit exit ramp — the fallback is hand-maintained TS types for the annotated surface, which is a bounded, modest cost if adoption is kept scoped. Do not annotate the entire domain model layer before this owner is assigned.

Scaling Generation time scales linearly with annotated class count; fine into the low thousands of classes. Large monorepos may need path scoping to keep runs fast and output isolated per package. Container execution keeps CI consistent as the repo grows.

Failure modes

  • Silent type widening: unknown property types fall back to TypeScriptBaseInterface, producing contracts that compile but don't match PHP. Highest-severity risk; needs a lint/review rule for generated any-adjacent output.
  • Fail-closed package.json guard: generation now aborts if it cannot create package.json. Correct in spirit, but in monorepos where package.json lives at a different level this presents as a hard build break — verify path configuration before CI rollout.
  • Drift: generated types go stale if the step is skipped or bypassed. Only the CI diff check reliably prevents this.
  • Hand-edited generated files: overwritten silently on next run. Mitigate with a "generated — do not edit" header and codegen excluded from manual edits by convention.

Ramp-up Low. The attribute is self-documenting and a mid-level developer can adopt it in an hour. The genuine learning curve is the type-mapping rules and knowing when a fallback has occurred — that knowledge should live with the designated owner rather than be assumed across the team.

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.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels