PHPackages                             mpstr24/laravel-interface-generator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mpstr24/laravel-interface-generator

ActivePackage[Utility &amp; Helpers](/categories/utility)

mpstr24/laravel-interface-generator
===================================

Laravel package to generate TypeScript interfaces.

v1.3.0(1y ago)0731MITPHPPHP ^8.0CI passing

Since Feb 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/MPSTR24/laravel-interface-generator)[ Packagist](https://packagist.org/packages/mpstr24/laravel-interface-generator)[ Docs](https://github.com/MPSTR24/laravel-interface-generator)[ RSS](/packages/mpstr24-laravel-interface-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

Laravel Interface Generator
===========================

[](#laravel-interface-generator)

This package is designed to automatically generate TypeScript interfaces from your Laravel models. It supports generating interfaces based on either model fillables or database migrations, it will also try to include relationships by analysing your model methods.

> **Note:** This package has been primarily tested with MySQL. SQLite and other drivers are a work in progress.

[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/25c1652cdab37c3e04261e07105d83f7e3b801f33dfe77ceb67b8edca07283b0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d7073747232342f6c61726176656c2d696e746572666163652d67656e657261746f722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e)](https://camo.githubusercontent.com/25c1652cdab37c3e04261e07105d83f7e3b801f33dfe77ceb67b8edca07283b0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d7073747232342f6c61726176656c2d696e746572666163652d67656e657261746f722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e)[![Packagist Version](https://camo.githubusercontent.com/3ccad9f91f32a12ca3eda7b05491bf8691cfc1552631dd1bc93776929d48f75b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d7073747232342f6c61726176656c2d696e746572666163652d67656e657261746f72)](https://camo.githubusercontent.com/3ccad9f91f32a12ca3eda7b05491bf8691cfc1552631dd1bc93776929d48f75b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d7073747232342f6c61726176656c2d696e746572666163652d67656e657261746f72)[![Packagist Downloads](https://camo.githubusercontent.com/19b284b15cf683a771097a7185b56ae23752940693151736f14d6da55de46ae4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d7073747232342f6c61726176656c2d696e746572666163652d67656e657261746f72)](https://camo.githubusercontent.com/19b284b15cf683a771097a7185b56ae23752940693151736f14d6da55de46ae4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d7073747232342f6c61726176656c2d696e746572666163652d67656e657261746f72)

Features
--------

[](#features)

- Interface Generation: Automatically generate TypeScript interfaces from Laravel
    - Generates interfaces from your model's fillable attributes or from your model's database migration.
- Relationship Detection: Automatically includes relationships in your interfaces.
    - With the ability to disable this feature.
    - Currently working with:
        - HasOne
        - HasMany
        - BelongsTo
        - BelongsToMany
        - MorphMany
        - MorphTo
- Customisable Suffix: Ability to customise or remove a suffix to each interface.
- Model Targeting: Ability to generate interfaces on all or specific models.

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

[](#installation)

Install the package via Composer:

```
composer require mpstr24/laravel-interface-typer
```

Usage/Examples
--------------

[](#usageexamples)

Basic usage. Run the following to generate interfaces from your migrations with the default suffix "Interface":

```
php artisan generate:interfaces
```

### Mode Options

[](#mode-options)

You can choose between generating interfaces from migrations or fillables using the --mode (or -M) option.

- Fillables Mode:

```
php artisan generate:interfaces --mode=fillables
```

- Migrations Mode:

```
php artisan generate:interfaces --mode=migrations
```

### Suffix Options

[](#suffix-options)

Customise the suffix added to your generated interface names using the --suffix (or -S) option.

- Custom Suffix (default "Interface"):

```
php artisan generate:interfaces --suffix=Interface
```

- No Suffix:

```
php artisan generate:interfaces --suffix=
```

### Model Selection

[](#model-selection)

To generate an interface for a specific model, please use the --model option. If not used or set to all, all models within the "app/Models" directory will be generated.

- Specific Model

```
php artisan generate:interfaces --model=TestUser
```

- All Models

```
php artisan generate:interfaces --model=all
```

Or alternatively.

```
php artisan generate:interfaces
```

### Relationship Toggling

[](#relationship-toggling)

You may not want to always generate relationships in your interfaces, to turn this off please use --relationships=False.

- Relationships enabled (leave blank or set "True")

```
php artisan generate:interfaces --relationships=True
```

- Relationships disabled

```
php artisan generate:interfaces --relationships=False
```

Or alternatively.

```
php artisan generate:interfaces
```

Roadmap
-------

[](#roadmap)

- Better Model discovery
- Better relationship discovery
- Finalising unknown types within mapping
- Adding of morphTo
- Configuration file for wider and customisable default settings
- Interface export options
- Testing to be implemented
- Testing to be improved
- SQLite testing
- Mapping separation for separate DB drivers
- Finish remaining relationship types
    - HasOneThrough
    - HasManyThrough
    - MorphOne
    - MorphToMany
    - MorphedByMany
- Larastan goals
    - 5
    - 6
    - 7
    - 8
    - 9

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance44

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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 ~0 days

Total

4

Last Release

436d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/773463d85604eb752853b3c3a25480bbadba2eb6215eb22669497192b2cb1d21?d=identicon)[MPSTR](/maintainers/MPSTR)

---

Top Contributors

[![MPSTR24](https://avatars.githubusercontent.com/u/74561948?v=4)](https://github.com/MPSTR24 "MPSTR24 (113 commits)")

---

Tags

interface-builderlaravellaravel-packagephp8typescriptlaravelgeneratortypescript

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mpstr24-laravel-interface-generator/health.svg)

```
[![Health](https://phpackages.com/badges/mpstr24-laravel-interface-generator/health.svg)](https://phpackages.com/packages/mpstr24-laravel-interface-generator)
```

###  Alternatives

[lara-zeus/accordion

Zeus Accordion is filamentphp layout component to group components

11122.8k2](/packages/lara-zeus-accordion)[akira/laravel-qrcode

A clean, modern, and easy-to-use QR code generator for Laravel

431.4k](/packages/akira-laravel-qrcode)[tomatophp/filament-helpers

Helper Class Generator to manage your forms and table inside your filament app

127.9k](/packages/tomatophp-filament-helpers)

PHPackages © 2026

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