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 Ts Publish Laravel Package

abetwothree/laravel-ts-publish

A Laravel package for publishing TypeScript definitions from your application. It streamlines keeping PHP and TypeScript types in sync, reducing manual duplication and helping frontend and backend stay aligned in TypeScript-powered Laravel projects.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

  • Architecture fit: The package fits Laravel applications that expose backend models, resources, enums, and relations to a TypeScript frontend. v2.7.0 materially improves the integrity of the generated TypeScript contract: generated files now reference files the run actually writes, related models are auto-published when needed, duplicate class names receive distinct aliases, and the global declaration file parses reliably. This reduces the need for manual type shims and post-generation fixes.
  • Integration feasibility: Upgrade is likely feasible without application-code changes. No breaking changes are called out, but generated output will change in many projects due to auto-published related models, improved aliasing, corrected namespace casing, and new warnings. Teams should expect a generated-file diff and a TypeScript validation pass after upgrading.
  • Technical risk: Auto-publishing related models expands the generated surface to vendor package models and Laravel models such as DatabaseNotification. These receive interfaces only, so projects expecting metadata or Vite plugin updates for those models must still add them to models.additional_directories. Relation introspection can still depend on runtime state; v2.7.0 prevents such relations from stopping ts:publish, but omitted or unreadable relations need review. Enum and class name collisions remain possible and are surfaced as warnings rather than silently fixed.
  • Key questions: Which models and directories are intentionally included or excluded? Is generated output committed to source control or produced during build? Does the frontend tsconfig consume the global declaration file, and will the namespace casing change from kebab-case to camelCase affect existing imports? Are auto-published vendor/Laravel model interfaces acceptable in the public type surface? Who triages new ts:publish warnings, and will CI fail on warnings or only on TypeScript errors?

Integration Approach

  • Stack fit: Strong fit for Laravel plus a TypeScript frontend using Vite or a similar build pipeline. The package’s ts:publish command should run wherever generated types are produced, ideally in CI and local build scripts. The v2.7.0 fixes align well with projects already using generated model/resource/enum types.
  • Migration path: Update the package to v2.7.0, run ts:publish, inspect the generated diff, run the frontend TypeScript compiler, and resolve any new warnings. Adjust models.excluded, models.included, #[TsExclude], or #[TsEnum] only where the generated surface is intentionally narrowed or renamed. If related models need metadata files or Vite plugin updates, add them to models.additional_directories.
  • Compatibility: Verify the package’s PHP, Laravel, Node, and TypeScript constraints against the project before upgrade. Confirm that generated files still satisfy the frontend tsconfig, especially if the global declaration file is consumed. The release notes indicate --only-resources and --source runs now type morphTo unions consistently with full runs, reducing mode-specific inconsistencies.
  • Sequencing: Upgrade dependency → run ts:publish → review new warnings and generated diffs → run frontend typecheck → update include/exclude and enum aliases → commit or publish generated artifacts → deploy. For monorepos or multiple frontends, regenerate all affected type outputs on a feature branch before merge.

Operational Impact

  • Maintenance: Related models no longer need to be manually added to models.additional_directories just to resolve relation imports, reducing routine maintenance. However, teams still need to maintain exclusion rules, enum aliases, and decisions about whether auto-published vendor models should remain in the generated interface surface. New warnings create explicit maintenance tasks rather than hidden TypeScript failures.
  • Support: Support burden should decrease for common generated-type failures: missing imports, duplicate aliases, broken global declaration parsing, and {Model}All relation/column collisions. Support may temporarily increase during upgrade as teams triage new warnings and review generated diffs. Document the ts:publish command, warning meanings, and configuration knobs for developers.
  • Scaling: Larger Laravel applications may see more generated files because related models are now published automatically. This improves correctness but can increase generation time and type surface. Use models.excluded, models.included, and #[TsExclude] to keep vendor or legacy models out of scope. Consider caching or scheduled regeneration if generation becomes slow in CI.
  • Failure modes: A relation that throws when read no longer stops ts:publish; it is omitted and should be reviewed. A related model that cannot be read generates a warning. Models whose table does not exist are skipped. Duplicate enum names in one namespace generate warnings. Properties typed by non-generated classes become unknown rather than importing missing files. The global declaration file is now more robust, including multi-word namespace segments and shared names across namespaces.
  • Ramp-up: Low to moderate. Developers need to understand the publish command, include/exclude configuration, #[TsExclude] and #[TsEnum], and the difference between interface-only auto-published models and models configured for full metadata. TPM oversight should focus on CI gating, warning triage ownership, and review of generated diffs during the v2.7.0 upgrade.
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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings