fr3on/laravel-bond

Automatically generate TypeScript types from Laravel API Resources, Form Requests, and Enums for a type-safe frontend.

Maintainers

Package info

github.com/fr3on/laravel-bond

pkg:composer/fr3on/laravel-bond

Statistics

Installs: 60

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.0.1 2026-04-12 13:42 UTC

This package is auto-updated.

Last update: 2026-04-12 13:43:57 UTC


README

GitHub license PHP Version Laravel Version Tests

Generates TypeScript types from Laravel API Resources, Form Requests, and Enums. PHP is the single source of truth—frontend types are never written by hand.

Installation

composer require fr3on/laravel-bond

Usage

Generate types for your configured paths:

php artisan bond:generate

Watch for changes during development:

php artisan bond:watch

Expected Result

The package generates a single TypeScript file (default: resources/js/types/api.ts) containing your definitions:

// auto-generated by laravel-bond — do not edit
// generated: 2026-04-12T10:00:00Z

export interface UserResource {
  id: number
  name: string
  email: string
  avatar: string | null
  roles: RoleResource[]
  created_at: string  // ISO 8601
}

export interface CreateUserRequest {
  name: string
  email: string
  password: string
  role_id: number
}

export type UserStatus = 'active' | 'suspended' | 'pending'

Configuration

Publish the config file:

php artisan vendor:publish --tag=bond-config

Customize paths and output format in config/bond.php.