PHPackages                             lumore/laravel-typescript - 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. lumore/laravel-typescript

ActiveLibrary

lumore/laravel-typescript
=========================

Transform Laravel models into TypeScript interfaces

v1.1.0(1y ago)2423—7.7%MITPHPPHP ^8.0|^8.2CI passing

Since Jan 20Pushed 1y agoCompare

[ Source](https://github.com/lumore/laravel-typescript)[ Packagist](https://packagist.org/packages/lumore/laravel-typescript)[ Docs](https://github.com/lumore/laravel-typescript)[ GitHub Sponsors](https://github.com/lepikhinb)[ GitHub Sponsors](https://github.com/lumore)[ RSS](/packages/lumore-laravel-typescript/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (7)Versions (3)Used By (0)

This is a fork of `lepikhinb/laravel-typescript`
------------------------------------------------

[](#this-is-a-fork-of-lepikhinblaravel-typescript)

**Warning**: This package only supports Laravel 11+

To

---

Laravel TypeScript
==================

[](#laravel-typescript)

[![Latest Version on Packagist](https://camo.githubusercontent.com/feb69d749cfa02020720a850f421132638575ec61908069743ebe228a0e7e7b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c756d6f72652f6c61726176656c2d747970657363726970742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lumore/laravel-typescript)[![GitHub Tests Action Status](https://camo.githubusercontent.com/d2ce22bb2a1a1c5f0db960e1693c19f5fd341bdd05e1f4c5bae03112ac8f3f20/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6c756d6f72652f6c61726176656c2d747970657363726970742f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/lumore/laravel-typescript/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/2f0458a3140d82a30f9d7d86595e8413fdbd9691ea9144035572ba4184ef35ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c756d6f72652f6c61726176656c2d747970657363726970742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lumore/laravel-typescript)

The package lets you generate TypeScript interfaces from your Laravel models.

Introduction
------------

[](#introduction)

Say you have a model which has several properties (database columns) and multiple relations.

```
class Product extends Model
{
    public function category(): BelongsTo
    {
        return $this->belongsTo(Category::class);
    }

    public function features(): HasMany
    {
        return $this->hasMany(Feature::class);
    }
}
```

Laravel TypeScript will generate the following TypeScript interface:

```
declare namespace App.Models {
    export interface Product {
        id: number;
        category_id: number;
        name: string;
        price: number;
        created_at: string | null;
        updated_at: string | null;
        category?: App.Models.Category | null;
        features?: Array | null;
    }
    ...
}
```

**Laravel TypeScript** supports:

- Database columns
- Model relations
- Model accessors
- Casted attributes

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

[](#installation)

**Laravel 11 and PHP 8 are required.**You can install the package via composer:

```
composer require lumore/laravel-typescript
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Lumore\TypeScript\TypeScriptServiceProvider" --tag="typescript-config"
```

This is the contents of the published config file:

```
return [
    'generators' => [
        Model::class => ModelGenerator::class,
    ],

    'output' => resource_path('js/models.d.ts'),

    // load namespaces from composer's `dev-autoload`
    'autoloadDev' => false,
];
```

Usage
-----

[](#usage)

Generate TypeScript interfaces.

```
php artisan typescript:generate
```

Example usage with Vue 3:

```
import { defineComponent, PropType } from "vue";

export default defineComponent({
    props: {
        product: {
            type: Object as PropType,
            required: true,
        },
    },
}
```

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Adil Rakhimbayev](https://github.com/lumore)
- [Boris Lepikhin](https://github.com/lepikhinb)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance46

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78% 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 ~59 days

Total

2

Last Release

415d ago

PHP version history (2 changes)v1.0.0PHP ^8.0

v1.1.0PHP ^8.0|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/b4b2f1c77605468fb0edbb2074134bf2470680ddac864b1a029ccc7ced2ec38c?d=identicon)[lumore](/maintainers/lumore)

---

Top Contributors

[![lepikhinb](https://avatars.githubusercontent.com/u/17538801?v=4)](https://github.com/lepikhinb "lepikhinb (39 commits)")[![media253](https://avatars.githubusercontent.com/u/28750663?v=4)](https://github.com/media253 "media253 (3 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![Litiano](https://avatars.githubusercontent.com/u/8152537?v=4)](https://github.com/Litiano "Litiano (1 commits)")[![robmeijerink](https://avatars.githubusercontent.com/u/14540290?v=4)](https://github.com/robmeijerink "robmeijerink (1 commits)")[![chancezeus](https://avatars.githubusercontent.com/u/2089196?v=4)](https://github.com/chancezeus "chancezeus (1 commits)")[![xyNNN](https://avatars.githubusercontent.com/u/1929750?v=4)](https://github.com/xyNNN "xyNNN (1 commits)")[![ekvedaras](https://avatars.githubusercontent.com/u/3586184?v=4)](https://github.com/ekvedaras "ekvedaras (1 commits)")[![jf908](https://avatars.githubusercontent.com/u/2487520?v=4)](https://github.com/jf908 "jf908 (1 commits)")

---

Tags

laraveltypescript

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/lumore-laravel-typescript/health.svg)

```
[![Health](https://phpackages.com/badges/lumore-laravel-typescript/health.svg)](https://phpackages.com/packages/lumore-laravel-typescript)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)

PHPackages © 2026

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