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.
.ts interface files (or a bespoke codegen script) with attribute-driven generation from your existing PHP classes. The 1.0.0 tag is the first signal that this is a supported dependency rather than a prototype, so it can now be evaluated as a real "buy" option against ~1–2 weeks of internal codegen work.TypeScriptMe PHP Attribute makes contract declaration opt-in and co-located with the DTO/model it describes. That turns "we should type our API payloads" from a cross-team migration project into an incremental, file-by-file adoption — a much smaller roadmap item to schedule.package.json" converts a silent partial-output failure into a hard stop. That supports gating frontend builds on successful generation instead of debugging phantom type mismatches downstream.TypeScriptBaseInterface fix for unknown property types tells you the tool degrades gracefully on loosely-typed or untyped properties. Useful when scoping rollout to legacy modules where PHP type coverage is incomplete — you can sequence adoption by type-coverage maturity rather than waiting for a full typing pass.Adopt when:
package.json failure guard both point at a CI-first workflow.phpstan / php-cs / rector pass in this release is a reasonable proxy for maintainer rigor.Look elsewhere when:
openapi-typescript) — you'd be introducing a second source of truth.To executives: Our PHP backend and TypeScript frontend describe the same data twice, and every divergence is a bug that escapes to QA or production. This package generates the TypeScript definitions directly from the PHP classes we already maintain, so there is one source of truth and no manual sync. It reached its first stable release (1.0.0), which is the point at which it becomes reasonable to depend on. Cost is a dependency plus a small amount of class annotation; the alternative is building and indefinitely maintaining equivalent codegen in-house.
To engineering: Attribute-driven interface generation from existing PHP classes, runnable identically on host and in the container, which makes a "generated types are stale" check a straightforward CI gate. This release adds the TypeScriptMe attribute for co-located, opt-in contract declaration; fixes TypeScriptBaseInterface for unknown property types so partially-typed legacy classes don't break generation; and fails fast when package.json can't be written rather than emitting partial output. Codebase passes phpstan, php-cs and rector. Adoption is incremental — annotate one DTO, generate, commit — so we can pilot on a single module and measure drift-defect reduction before wider rollout.
How can I help you explore Laravel packages today?