PHPackages                             illuma-law/laravel-wayfinder-forge - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. illuma-law/laravel-wayfinder-forge

ActiveLibrary[API Development](/categories/api)

illuma-law/laravel-wayfinder-forge
==================================

Auto-generate strongly typed frontend SDKs from Laravel Wayfinder routes.

v0.1.4(1mo ago)03MITPHPPHP ^8.3CI passing

Since Apr 20Pushed 1mo agoCompare

[ Source](https://github.com/illuma-law/laravel-wayfinder-forge)[ Packagist](https://packagist.org/packages/illuma-law/laravel-wayfinder-forge)[ Docs](https://github.com/illuma-law/laravel-wayfinder-forge)[ RSS](/packages/illuma-law-laravel-wayfinder-forge/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (16)Versions (6)Used By (0)

Laravel Wayfinder Forge
=======================

[](#laravel-wayfinder-forge)

[![Latest Version on Packagist](https://camo.githubusercontent.com/38d2f864dab44e23130ee4a2b05a4562d31927086875d6df079d32d3224fedf1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696c6c756d612d6c61772f6c61726176656c2d77617966696e6465722d666f7267652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/illuma-law/laravel-wayfinder-forge)[![GitHub Tests Action Status](https://camo.githubusercontent.com/2cd41b61fcb8c941d8bf60b6b4e72b305c44359dbe405a62ec61ff77e14556b6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f696c6c756d612d6c61772f6c61726176656c2d77617966696e6465722d666f7267652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/illuma-law/laravel-wayfinder-forge/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/63088c97b5df9c3f3be6da38b13d928b71acf4a224d5ce62e9b87aded2e3083d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696c6c756d612d6c61772f6c61726176656c2d77617966696e6465722d666f7267652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/illuma-law/laravel-wayfinder-forge)

Auto-generate strongly typed frontend SDKs from your Laravel backend routes and FormRequests.

Wayfinder Forge ensures your frontend client code stays perfectly in sync with your backend validation rules. It parses your Laravel routes, reflects on their `FormRequest` or `Spatie\Data` classes, and automatically generates a ready-to-use TypeScript SDK.

Features
--------

[](#features)

- **TypeScript Interface Generation:** Automatically converts Laravel validation rules (`required`, `string`, `nullable`, `array`) into accurate TypeScript interfaces.
- **Spatie Laravel Data Support:** First-class support for `spatie/laravel-data` DTOs.
- **Multiple Client Support:** Generates SDKs formatted for `axios`, standard `fetch`, or `inertia`.
- **Customizable Output:** Easily define which routes to include/exclude via prefixes and middleware filters.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require illuma-law/laravel-wayfinder-forge --dev
```

Publish the config file:

```
php artisan vendor:publish --tag="laravel-wayfinder-forge-config"
```

Configuration
-------------

[](#configuration)

The published `config/wayfinder-forge.php` allows you to customize the output behavior:

```
return [
    /**
     * The output path for the generated TypeScript SDK file.
     */
    'output_path' => resource_path('js/api/sdk.ts'),

    /**
     * Define which routes should be processed.
     */
    'routes' => [
        // Only include routes matching these prefixes
        'include_prefixes' => [
            'api/*',
        ],

        // Exclude routes with specific middleware (like internal debug tools)
        'exclude_middlewares' => [
            'debugbar',
        ],
    ],

    /**
     * The HTTP client template to use for the generated SDK.
     * Supported: 'axios', 'fetch', 'inertia'
     */
    'client' => 'axios',

    /**
     * Enable support for spatie/laravel-data objects.
     */
    'use_spatie_data' => true,
];
```

Usage &amp; Integration
-----------------------

[](#usage--integration)

Generate your TypeScript SDK by running the forge command:

```
php artisan wayfinder:forge
```

*Tip: Add this command to your `package.json` build scripts so it runs automatically during development.*

### Example: FormRequests

[](#example-formrequests)

#### Laravel Controller &amp; Request

[](#laravel-controller--request)

```
namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StorePostRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'title' => 'required|string|max:255',
            'content' => 'required|string',
            'is_published' => 'boolean', // Optional by default unless 'required' is present
        ];
    }
}

// routes/api.php
Route::post('api/posts', [PostController::class, 'store'])->name('posts.store');
```

#### Generated TypeScript SDK (`resources/js/api/sdk.ts`)

[](#generated-typescript-sdk-resourcesjsapisdkts)

```
export interface ApiPostsRequest {
    title: string;
    content: string;
    is_published?: boolean;
}

export const postsStore = (data: ApiPostsRequest) => {
    return axios.post(`/api/posts`, data);
};
```

### Example: Spatie Laravel Data

[](#example-spatie-laravel-data)

If you are using `spatie/laravel-data` to type-hint your controllers instead of FormRequests, Forge handles that automatically.

#### Laravel Controller &amp; Data Object

[](#laravel-controller--data-object)

```
namespace App\Data;

use Spatie\LaravelData\Data;

class UserData extends Data
{
    public string $name;
    public ?int $age;
}

// routes/api.php
Route::post('api/users', function (UserData $userData) {
    // ...
});
```

#### Generated TypeScript SDK

[](#generated-typescript-sdk)

```
export interface UserData {
    name: string;
    age?: number;
}

export const apiUsers = (data: UserData) => {
    return axios.post(`/api/users`, data);
};
```

Testing
-------

[](#testing)

Run the package tests:

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance91

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

5

Last Release

44d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2affac64f2726a640084b203503518ca01f582536d60a0a299b614486ed95aaa?d=identicon)[miguelenes](/maintainers/miguelenes)

---

Top Contributors

[![miguelenes](https://avatars.githubusercontent.com/u/1568086?v=4)](https://github.com/miguelenes "miguelenes (13 commits)")

---

Tags

laraveltypescriptwayfindersdk generatorilluma-law

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/illuma-law-laravel-wayfinder-forge/health.svg)

```
[![Health](https://phpackages.com/badges/illuma-law-laravel-wayfinder-forge/health.svg)](https://phpackages.com/packages/illuma-law-laravel-wayfinder-forge)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[laravel/ai

The official AI SDK for Laravel.

9782.1M153](/packages/laravel-ai)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

24740.3k](/packages/harris21-laravel-fuse)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
