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 Typeable Laravel Package

kiwilan/laravel-typeable

Laravel Typeable adds polymorphic types to Eloquent models, letting you attach reusable Type records to any model through a typeables pivot. Includes migrations, a Type model, and a Typeable trait with helpers to sync, filter, and query types.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy vs. hand-roll for the API contract layer. The recurring alternative is developers hand-maintaining TypeScript interfaces next to PHP models. That works until it doesn't: a renamed column or a new cast silently ships a broken frontend. This package makes the contract a generated artifact rather than a convention, which is a decision you can make once and enforce in CI. Hand-rolling is "free" until the first production bug caused by drift; this is the cheap middle path before you'd invest in a full OpenAPI/GraphQL schema pipeline.
  • Frontend stack standardization (Inertia + TypeScript). If Inertia is on the roadmap, this is a supporting argument: type-safe props, typed routes for route()-style calls, and typed Spatie Settings payloads mean the TS experience is real rather than nominal. It strengthens the case for TypeScript adoption by removing the "we'll still be guessing at shapes" objection.
  • Reducing the blast radius of schema refactors. Deciding whether to rename a model attribute, change a cast, or restructure a Settings group is currently a judgement call about who might be consuming it. With generated types, the frontend fails at compile time instead of runtime — that changes the risk calculus on refactors and makes cleanup work schedulable rather than scary.
  • Onboarding cost and time-to-first-PR. New full-stack contributors get IDE autocomplete and compile errors instead of tribal knowledge. This is a lever on ramp-up velocity, which is usually an explicit PM goal for growing teams.
  • Tooling consolidation decision. Today the typical stack needs separate solutions for route typing (Ziggy / Wayfinder) and model typing (laravel-data's transformer or a custom script). One package covering models, routes, and Spatie Settings is a real simplification of the build step — worth evaluating against the official Laravel Wayfinder direction, which overlaps on routes.
  • CI and release-gating scope. Adopting it means a new step in the pipeline: regenerate and diff. That's a small but concrete roadmap item, and it's the mechanism that converts the tool from "nice DX" into an actual guardrail.

When to Consider This Package

Adopt it (after a spike, not blind) when most of these hold:

  • Inertia + TypeScript is your frontend, in a monorepo where PHP and TS ship together and generated types can be committed or built in CI.
  • You already use Spatie Settings, or plan to — the Settings coverage is the differentiating surface and the part hardest to replace.
  • The team is small-to-mid and the cost of one more build dependency is lower than the cost of contract drift.
  • You want one tool for models, routes, and settings rather than three, and you're on a supported Laravel version with a modern PHP runtime.
  • Reversibility matters and you're comfortable with codegen. Because output is checked-in or CI-diffed files, ejecting is cheap: you keep the last generated types and maintain them by hand. Low lock-in is this package's strongest structural argument.

Look elsewhere when any of these dominate:

  • API-first architecture with non-Inertia consumers (mobile, partner integrations). You need a published contract — OpenAPI-first or GraphQL codegen — not a Laravel-internal type emitter. Generating TS types for one consumer while other consumers hand-parse JSON is a half-answer.
  • Livewire / Blade / Alpine only, no TypeScript. No consumer, no value.
  • Route typing is your primary need. Laravel's first-party Wayfinder is the safer long-term bet for routes and controllers; adopting this for routes alone means betting on a 39-star package against the framework vendor.
  • Your models lean on heavy custom casts, accessors, or polymorphic relations. Verify the generator resolves them accurately before committing — a type generator that emits subtly wrong types is worse than none, because it creates false confidence. This is the specific thing to test in the spike.
  • You require vendor support, an SLA, or a security review of dependencies. Single-maintainer, small-community projects fail that bar regardless of quality.
  • The project is short-lived (< ~6 months) or a throwaway prototype. The setup and CI wiring won't pay back.

The spike is the decision. Budget roughly a day: run it against your real models and settings (not a toy app), confirm the emitted types are correct for your gnarliest models, check open-issue responsiveness and Laravel-version support in the repo, and pin the version. Treat "generated types are accurate for our domain" as the go/no-go gate, and the community size as a managed risk rather than a blocker given how easily you can eject.

How to Pitch It (Stakeholders)

To executives: This is a small, MIT-licensed tool that removes a class of bugs we currently only catch in QA or production — the frontend and backend disagreeing about data shapes. The expected return is fewer integration defects and faster onboarding for full-stack developers, at effectively zero license cost and roughly a day of setup. The trade-off is a new build-step dependency on a small open-source project; it's cheap to reverse because the output is just files we can keep. I'd frame approval as funding a one-day evaluation, not a platform commitment.

To engineering: It generates TypeScript from our Eloquent models, routes, and Spatie Settings, so props, route helpers, and settings payloads are typed from the single source of truth instead of retyped by hand. It adds a codegen step to the build and a regenerate-and-diff check to CI, which is what makes drift visible at compile time. Where we need to be careful: the project has ~39 stars and one maintainer, so we pin the version, wrap the invocation in our own script so the command surface is ours, and validate the output against our most complex models before rollout. If it disappoints, we keep the last generated output and walk away — no migration project required. Also worth an explicit comparison during the spike: Laravel's Wayfinder overlaps on route typing, so if routes are our main pain we should evaluate that first and use this package for the model and Settings surfaces only.

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.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel