wayfinder
15
总安装量
9
周安装量
#21893
全站排名
安装命令
npx skills add https://github.com/markhamsquareventures/essentials --skill wayfinder
Agent 安装分布
gemini-cli
7
antigravity
6
claude-code
6
opencode
6
windsurf
5
Skill 文档
Wayfinder
Instructions
Wayfinder generates TypeScript functions and types for Laravel controllers and routes which you can import into your client side code. It provides type safety and automatic synchronization between backend routes and frontend code.
Development Guidelines
- Always Prefer named imports for tree-shaking (e.g.,
import { show } from '@/actions/...') - Avoid default controller imports (prevents tree-shaking)
- Run
php artisan wayfinder:generateafter route changes if there are any errors
Feature Overview
- Form Support: Use
.form()with--with-formflag for HTML form attributes â<form {...store.form()}>âaction="/posts" method="post" - HTTP Methods: Call
.get(),.post(),.patch(),.put(),.delete()for specific methods âshow.head(1)â{ url: "/posts/1", method: "head" } - Invokable Controllers: Import and invoke directly as functions. For example,
import StorePost from '@/actions/.../StorePostController'; StorePost() - Named Routes: Import from
@/routes/for non-controller routes. For example,import { show } from '@/routes/post'; show(1)for route namepost.show - Parameter Binding: Detects route keys (e.g.,
{post:slug}) and accepts matching object properties âshow("my-post")orshow({ slug: "my-post" }) - Query Merging: Use
mergeQueryto merge withwindow.location.search, set values tonullto remove âshow(1, { mergeQuery: { page: 2, sort: null } }) - Query Parameters: Pass
{ query: {...} }in options to append params âshow(1, { query: { page: 1 } })â"/posts/1?page=1" - Route Objects: Functions return
{ url, method }shaped objects âshow(1)â{ url: "/posts/1", method: "get" } - URL Extraction: Use
.url()to get URL string âshow.url(1)â"/posts/1"
Examples
// Get route object with URL and method...
show(1) // { url: "/posts/1", method: "get" }
// Get just the URL...
show.url(1) // "/posts/1"
// Use specific HTTP methods...
show.get(1) // { url: "/posts/1", method: "get" }
show.head(1) // { url: "/posts/1", method: "head" }
// Import named routes...
import { show as postShow } from '@/routes/post' // For route name 'post.show'
postShow(1) // { url: "/posts/1", method: "get" }
Wayfinder + Inertia
If your application uses the <Form> component from Inertia, you can use Wayfinder to generate form action and method automatically.