New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

pentacore/laravel-typefinder

Auto-generate TypeScript type definitions from Laravel Models, Enums, Casts, and Requests.
3,192 2
Install
composer require pentacore/laravel-typefinder
Latest Version:5.0.2
PHP:^8.4
Laravel:12 · 13
Older releases:11
License:MIT
Last Updated:Oct 23, 2026
Links: GitHub  ·  Packagist
Maintainer: pentacore

Laravel Typefinder

Tests codecov License semantic-release

Packagist Version Packagist Downloads NPM Version NPM Downloads

Laravel Typefinder auto-generates TypeScript type definitions (.d.ts files) from your Laravel application. It introspects Eloquent models, backed enums, Form Requests, API Resources, Inertia controllers, broadcast events, and pivot tables to produce accurate, always-fresh types — no manual maintenance required. Ships with opt-in attributes (#[TypefinderOverrides], #[TypefinderWriteShape], #[TypefinderResource], #[TypefinderPage], #[TypefinderBroadcast], #[TypefinderCast], #[TypefinderIgnore]) for the cases where static inference needs a nudge, plus a runtime facade for registering types for third-party casts.

Contents

Packages

Package Install
pentacore/laravel-typefinder composer require pentacore/laravel-typefinder
@pentacore/vite-plugin-laravel-typefinder npm i -D @pentacore/vite-plugin-laravel-typefinder

At a glance

You write this:

// app/Models/Post.php
class Post extends Model
{
    protected $casts = [
        'status' => PostStatus::class,
        'published_at' => 'datetime',
    ];

    public function author(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }
}

Typefinder emits this:

// resources/js/typefinder/models/Post.d.ts
import type { PostStatus } from '../enums';
import type { User } from './User';

export type Post = {
  id: number;
  title: string;
  status: PostStatus;
  published_at: string | null;
  author?: User | null;
};

export type PostCreate = { title: string; status: PostStatus; published_at?: string | null };
export type PostUpdate = { title?: string; status?: PostStatus; published_at?: string | null };

No decorators, no manual schemas — it reads your migrations, $casts, and relationships directly.

Quick start

1. Install the Composer package:

composer require pentacore/laravel-typefinder

2. Register the Vite plugin (vite.config.js):

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import typefinder from '@pentacore/vite-plugin-laravel-typefinder';

export default defineConfig({
    plugins: [
        laravel({ input: ['resources/js/app.js'] }),
        typefinder(),
    ],
});

3. Generate types:

php artisan typefinder:generate

Types are written to resources/js/typefinder/ by default. The Vite plugin re-runs generation automatically on HMR file changes.

Supported matrix

Every cell below is exercised in CI on every push and PR.

PHP 8.4 PHP 8.5
Laravel 12 ✅ ✅
Laravel 13 ✅ ✅

Documentation

Full documentation for each package:

  • packages/laravel-typefinder/README.md — configuration, every generated category (models / enums / requests / resources / pivots / pages / broadcasting / helpers), the full attribute reference, the third-party cast registry, and the artisan commands (typefinder:generate, typefinder:watch) with flags (--check, --json, --debug, --only=).
  • packages/vite-plugin-laravel-typefinder/README.md — plugin options, debounce behaviour, alternative install from vendor

Development

# Install PHP dependencies
composer install

# Install JS dependencies
npm install

# Run PHP tests
vendor/bin/phpunit

# Check PHP code style
vendor/bin/pint --test

# Build the Vite plugin
npm -w packages/vite-plugin-laravel-typefinder run build

# Lint the Vite plugin
npm -w packages/vite-plugin-laravel-typefinder run lint

Contributing

Bug reports, feature proposals, and PRs are welcome. Start with CONTRIBUTING.md — it covers the commit-message convention (Conventional Commits), the pre-commit toolchain (pint, rector, npm run lint), and the CI matrix your changes need to pass.

Security

If you've found a security issue, please follow the disclosure process in SECURITY.md rather than opening a public issue.

License

MIT — see LICENSE.

Related Packages

synergitech/laravel-magic-enums

A Laravel package that adds extra power to your PHP enums, and lets you use them...

10,280 9
vicgutt/laravel-models-finder

Find all models in your Laravel app or package

1,469 0
laravel/wayfinder

Generate TypeScript representations of your Laravel actions and routes.

18,679,820 1,863
gosuperscript/axiom

A PHP library for data transformation, type validation, and expression evaluatio...

84,551 0
devwizardhq/laravel-enumify

Auto-generate TypeScript enums and types from Laravel PHP enums with an Artisan...

2,341 7

Version History

Version Released PHP Laravel License
5.0.2 ^8.4 ^12.0|^13.0 MIT
5.0.1 ^8.4 ^12.0|^13.0 MIT
5.0.0 ^8.4 ^12.0|^13.0 MIT
4.2.3 ^8.3 ^11.0|^12.0|^13.0 MIT
4.2.2 ^8.3 ^11.0|^12.0|^13.0 MIT