PHPackages                             evanschleret/laravel-typebridge - 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. evanschleret/laravel-typebridge

ActiveLibrary[API Development](/categories/api)

evanschleret/laravel-typebridge
===============================

Generate deterministic TypeScript resources from Laravel resource attributes

v1.0.0(3d ago)01MITPHPPHP ^8.2CI passing

Since Mar 18Pushed 3d agoCompare

[ Source](https://github.com/EvanSchleret/laravel-typebridge)[ Packagist](https://packagist.org/packages/evanschleret/laravel-typebridge)[ RSS](/packages/evanschleret-laravel-typebridge/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

 [![Laravel TypeBridge banner](.github/assets/banner.png)](.github/assets/banner.png)

Laravel TypeBridge
==================

[](#laravel-typebridge)

 Deterministic TypeScript generation from Laravel resources.

 [![Packagist Version](https://camo.githubusercontent.com/a7ff929718afd96a9056f7148e1d4721bc9425533c4fc28d0c05a9438e8c89c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6576616e7363686c657265742f6c61726176656c2d747970656272696467653f6c6162656c3d7061636b6167697374)](https://packagist.org/packages/evanschleret/laravel-typebridge) [![Packagist Downloads](https://camo.githubusercontent.com/7cbcfe2bbfe2313d94dd513cba83fc4b6ef54a63e976084d56d59fc18d123a90/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6576616e7363686c657265742f6c61726176656c2d74797065627269646765)](https://packagist.org/packages/evanschleret/laravel-typebridge) [![License](https://camo.githubusercontent.com/b94e829854d47ce9c4edc5b0ee1153e1d63bad8af09ce5f27f6cf9180e566d00/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6576616e7363686c657265742f6c61726176656c2d74797065627269646765)](https://packagist.org/packages/evanschleret/laravel-typebridge) [![PHP >= 8.2](https://camo.githubusercontent.com/31a67572ee10d23c041c57eb58d5388aadcb63dfdc64932af8bcd2ecf6470b92/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e322d373737424234)](https://camo.githubusercontent.com/31a67572ee10d23c041c57eb58d5388aadcb63dfdc64932af8bcd2ecf6470b92/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e322d373737424234) [![Laravel 12.x | 13.x](https://camo.githubusercontent.com/fd6d9944c001a3eb844b08cf10b2fd294740921d358a48bbf7dff0cbf2b7d648/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322e7825323025374325323031332e782d464632443230)](https://camo.githubusercontent.com/fd6d9944c001a3eb844b08cf10b2fd294740921d358a48bbf7dff0cbf2b7d648/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322e7825323025374325323031332e782d464632443230)

Why this package
----------------

[](#why-this-package)

This package helps you keep backend resources and frontend types aligned, with deterministic output and predictable imports.

Requirements
------------

[](#requirements)

- PHP `>=8.2`
- Laravel `12.x` or `13.x`
- Note: Laravel `13.x` requires PHP `>= 8.3` (Laravel framework requirement)

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

[](#installation)

```
composer require --dev evanschleret/laravel-typebridge
```

Publish the config:

```
php artisan vendor:publish --provider="EvanSchleret\\LaravelTypeBridge\\TypeBridgeServiceProvider" --tag=typebridge-config
```

Generated file:

- `config/typebridge.php`

Basic usage
-----------

[](#basic-usage)

Generate files:

```
php artisan typebridge:generate
```

Use another output directory:

```
php artisan typebridge:generate --output-path=resources/typescript
```

Preview only (no write):

```
php artisan typebridge:generate --dry-run
```

Attribute example
-----------------

[](#attribute-example)

Use `TypeBridgeResource` on Laravel resources (`JsonResource` or `ResourceCollection`):

```
