PHPackages                             gaiatools/laravel-type-bridge - 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. gaiatools/laravel-type-bridge

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

gaiatools/laravel-type-bridge
=============================

A Laravel package for generating TypeScript/JavaScript enums and frontend translation files from your Laravel app.

v1.3.0(1mo ago)34.9k↑50%[1 PRs](https://github.com/GaiaTools/laravel-type-bridge/pulls)MITPHPPHP ^8.2|^8.3|^8.4|^8.5CI passing

Since Nov 22Pushed 1mo agoCompare

[ Source](https://github.com/GaiaTools/laravel-type-bridge)[ Packagist](https://packagist.org/packages/gaiatools/laravel-type-bridge)[ RSS](/packages/gaiatools-laravel-type-bridge/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (18)Versions (19)Used By (0)

Gaia Tools Laravel Type Bridge
==============================

[](#gaia-tools-laravel-type-bridge)

A Laravel package for generating TypeScript/JavaScript enums and frontend translation files from your Laravel app.

[![Release](https://camo.githubusercontent.com/bdc240fa4f6b34df05de470edea804402992c339d1a59f8071f58abb7881f1d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f47616961546f6f6c732f6c61726176656c2d747970652d6272696467653f736f72743d73656d76657226636f6c6f723d626c7565)](https://github.com/GaiaTools/laravel-type-bridge/releases)[![Quality Gate](https://camo.githubusercontent.com/780c7d3249050a501b84015a9b7dbc9226d17a170a8da4c4f3219dce314cdda7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64796e616d69632f6a736f6e3f75726c3d6874747073253341253246253246736f6e61722e7232776562736f6c7574696f6e732e636f6d2532466170692532466d65617375726573253246636f6d706f6e656e74253346636f6d706f6e656e7425334447616961546f6f6c735f6c61726176656c2d747970652d6272696467655f36356130636437312d333832632d343332322d613632382d6139373966386265623430312532366d65747269634b657973253344616c6572745f7374617475732671756572793d242e636f6d706f6e656e742e6d65617375726573253542302535442e76616c7565266c6162656c3d5175616c69747925323047617465266c6162656c436f6c6f723d626c61636b26636f6c6f723d253233303039393030)](https://sonar.r2websolutions.com/dashboard?id=GaiaTools_laravel-type-bridge_65a0cd71-382c-4322-a628-a979f8beb401)[![License](https://camo.githubusercontent.com/d682467c50b71444a67da555416e98549ace8c03154aa94835b00a4d27f68d26/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f47616961546f6f6c732f6c61726176656c2d747970652d6272696467653f6c6162656c3d4c6963656e7365266c6162656c436f6c6f723d626c61636b26636f6c6f723d253233303039393030)](https://github.com/GaiaTools/laravel-type-bridge/blob/main/LICENSE)[![Downloads](https://camo.githubusercontent.com/c6e704055051d7d88f378855c91b999c74a19fdf213aeeaed6e1d5ea2029246a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f47616961546f6f6c732f6c61726176656c2d747970652d6272696467652e7376673f6c6162656c3d446f776e6c6f616473266c6162656c436f6c6f723d626c61636b26636f6c6f723d253233303039393030)](https://packagist.org/packages/GaiaTools/laravel-type-bridge)[![Coverage](https://camo.githubusercontent.com/f9647bbadd405d90a0d7834473536136565e2534123b08453bd08391b67d164e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64796e616d69632f6a736f6e3f75726c3d6874747073253341253246253246736f6e61722e7232776562736f6c7574696f6e732e636f6d2532466170692532466d65617375726573253246636f6d706f6e656e74253346636f6d706f6e656e7425334447616961546f6f6c735f6c61726176656c2d747970652d6272696467655f36356130636437312d333832632d343332322d613632382d6139373966386265623430312532366d65747269634b657973253344636f7665726167652671756572793d242e636f6d706f6e656e742e6d65617375726573253542302535442e76616c7565267375666669783d253235266c6162656c3d436f766572616765266c6162656c436f6c6f723d626c61636b)](https://camo.githubusercontent.com/f9647bbadd405d90a0d7834473536136565e2534123b08453bd08391b67d164e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64796e616d69632f6a736f6e3f75726c3d6874747073253341253246253246736f6e61722e7232776562736f6c7574696f6e732e636f6d2532466170692532466d65617375726573253246636f6d706f6e656e74253346636f6d706f6e656e7425334447616961546f6f6c735f6c61726176656c2d747970652d6272696467655f36356130636437312d333832632d343332322d613632382d6139373966386265623430312532366d65747269634b657973253344636f7665726167652671756572793d242e636f6d706f6e656e742e6d65617375726573253542302535442e76616c7565267375666669783d253235266c6162656c3d436f766572616765266c6162656c436f6c6f723d626c61636b)

Features
--------

[](#features)

- Automatically discover and generate frontend enums from PHP backed enums
- Opt-in enum generation using the `#[GenerateEnum]` attribute
- Flexible discovery via configurable paths (supports Modules or custom structures)
- Generate TypeScript or JavaScript output
- Support for translation file generation (TS, JS, or JSON)
- Configurable backed-enum discovery toggle and excludes

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

[](#requirements)

- PHP 8.2 or higher
- Laravel 11.x orhigher

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

[](#installation)

Install the package via Composer:

```
composer require gaiatools/laravel-type-bridge
```

Publish the configuration file:

Smart config publishing

```
php artisan type-bridge:publish
```

Or Laravel config publishing

```
php artisan vendor:publish --tag=type-bridge-config
```

Configuration
-------------

[](#configuration)

See `config/type-bridge.php` for all configuration options and inline documentation.

Supported translation engines
-----------------------------

[](#supported-translation-engines)

The translator utilities generated by this package can work with multiple i18n libraries through a tiny "engine" interface (an object exposing `t(key: string): string`). Out of the box we support:

- i18next
- react-i18next (uses the same i18next engine)
- vue-i18n

Tip: In `config/type-bridge.php` you can set `i18n_library` to control how translation keys are generated/organized for your target library. The default `i18next` also covers `react-i18next`.

Usage
-----

[](#usage)

### Basic Enum Generation

[](#basic-enum-generation)

Create a backed enum in your Laravel application:

```
