Weave Code
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

Wayfinder Laravel Package

laravel/wayfinder

Zero‑friction Laravel → TypeScript bridge. Wayfinder auto‑generates fully typed, importable TS functions for your routes and controller actions, letting you call endpoints like normal functions—no hardcoded URLs, parameter guessing, or manual syncing.

View on GitHub
Deep Wiki
Context7

Laravel Wayfinder connects your Laravel backend to a TypeScript frontend by generating fully-typed, importable functions for your routes and controller actions. Instead of hardcoding URLs or manually syncing params, you call endpoints from client code like regular TypeScript functions—keeping types in lockstep with your app.

Designed to work seamlessly with Vite via the Wayfinder Vite plugin, definitions can be regenerated automatically on build and during dev as routes/controllers change.

  • Generates typed TS helpers for Laravel routes and controller methods
  • Eliminates manual URL/parameter wiring and drift
  • Artisan command to generate outputs with configurable base path
  • Options to skip actions or routes generation as needed
  • Outputs are fully regenerable and safe to .gitignore
Frequently asked questions about Wayfinder
How does Laravel Wayfinder improve TypeScript development with Laravel?
Wayfinder auto-generates strongly typed TypeScript functions for your Laravel routes and controller actions. This lets you call backend endpoints directly in your frontend code (e.g., `showPost(1)`) instead of hardcoding URLs or guessing parameters, ensuring type safety and reducing API drift.
Can I use Wayfinder without Vite or Inertia.js?
Yes, Wayfinder’s core functionality works without Vite or Inertia.js. The Vite plugin is optional but recommended for automatic regeneration during development. Inertia.js integration is opt-in and enhances form/Link support. The base Artisan command (`wayfinder:generate`) works standalone.
What Laravel versions does Wayfinder support?
Wayfinder officially supports Laravel 10+. It’s tested up to Laravel 13, but always check the [changelog](https://github.com/laravel/wayfinder/blob/main/CHANGELOG.md) for version-specific notes. The package is designed to align with Laravel’s routing conventions.
How do I handle dynamic routes or custom route resolvers?
Wayfinder relies on Laravel’s standard route naming and model binding. For dynamic routes (e.g., middleware-generated URLs) or custom resolvers, you may need to adjust the generated TypeScript types manually or use the `--skip-actions` flag for problematic controllers. Test thoroughly in staging.
Should I commit the generated Wayfinder files to Git?
No, the generated `wayfinder`, `actions`, and `routes` directories can be safely `.gitignored`. They’re fully regenerable on every build or via the Artisan command, ensuring they always match your current Laravel backend.
Does Wayfinder work with React, Vue, or vanilla TypeScript?
Absolutely. Wayfinder generates TypeScript definitions that work with any TypeScript-based frontend (React, Vue, Svelte, or vanilla TS). It’s especially useful for Inertia.js apps but isn’t tied to a specific framework. Just import the generated functions into your components.
How do I customize the output path or skip specific routes/actions?
Use the `--path` flag to specify a custom output directory (e.g., `--path=resources/js/wayfinder`). To skip generating TypeScript for specific routes or controller actions, use `--skip-routes` or `--skip-actions`. These options are useful for excluding legacy or third-party endpoints.
What happens if my controller method names conflict with TypeScript reserved words?
Wayfinder automatically renames controller methods that conflict with TypeScript reserved words (e.g., `delete` becomes `deleteMethod`). You’ll need to update your frontend code to use the renamed function, but this is handled transparently during generation.
Can Wayfinder generate form attributes like `action` and `method` for traditional HTML forms?
Yes! Enable form support with the `--with-form` flag during generation. Wayfinder will output TypeScript helpers that dynamically populate `<form>` attributes (e.g., `action`, `method`, `_method`) based on your Laravel routes, simplifying form submissions without hardcoding URLs.
Are there alternatives to Wayfinder for Laravel + TypeScript routing?
Alternatives include manually writing TypeScript route constants, using Laravel’s `route()` helper with runtime calls, or packages like `laravel-route-generator`. However, Wayfinder stands out by auto-generating *fully typed* functions for both routes *and* controller actions, reducing manual effort and drift. For headless APIs or non-TypeScript frontends, custom solutions may be more appropriate.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport