PHPackages                             devwizardhq/laravel-enumify - 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. devwizardhq/laravel-enumify

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

devwizardhq/laravel-enumify
===========================

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

v1.3.0(2mo ago)7298↓48%[2 PRs](https://github.com/DevWizardHQ/laravel-enumify/pulls)MITPHPPHP ^8.2CI passing

Since Jan 15Pushed 2mo agoCompare

[ Source](https://github.com/DevWizardHQ/laravel-enumify)[ Packagist](https://packagist.org/packages/devwizardhq/laravel-enumify)[ Docs](https://github.com/devwizardhq/laravel-enumify)[ GitHub Sponsors](https://github.com/DevWizard)[ RSS](/packages/devwizardhq-laravel-enumify/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (27)Versions (10)Used By (0)

Laravel Enumify
===============

[](#laravel-enumify)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b868d82fd6fff21e4c610ca72b66643be1007b21bc65b079f61d318d861e464a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64657677697a61726468712f6c61726176656c2d656e756d6966792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devwizardhq/laravel-enumify)[![GitHub Tests Action Status](https://camo.githubusercontent.com/266e24097bf0eab44f18b069edc298cdc2e332a28ed73bce461953ba8fd712f1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f64657677697a61726468712f6c61726176656c2d656e756d6966792f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/devwizardhq/laravel-enumify/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/2152dfc5a88b4546650a8a65981b40b43d010944e030dbf82c51ab826b4592fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64657677697a61726468712f6c61726176656c2d656e756d6966792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devwizardhq/laravel-enumify)[![NPM Version](https://camo.githubusercontent.com/add0bab3ad5eb9d97ba381d9289611acbb09a91db79265d21e0f91fc89a2688a/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f4064657677697a6172642f766974652d706c7567696e2d656e756d6966792e7376673f7374796c653d666c61742d737175617265)](https://www.npmjs.com/package/@devwizard/vite-plugin-enumify)[![NPM Downloads](https://camo.githubusercontent.com/3fe3062922d2b07948d57f5bd71d6c6055b50ab8df96fe7563996d972cbd8368/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f64742f4064657677697a6172642f766974652d706c7567696e2d656e756d6966792e7376673f7374796c653d666c61742d737175617265)](https://www.npmjs.com/package/@devwizard/vite-plugin-enumify)

**Auto-generate TypeScript enums from Laravel PHP enums. Refactor hardcoded values and normalize enum keys.**

Laravel Enumify keeps frontend TypeScript enums in sync with backend PHP enums automatically. It also scans your codebase for hardcoded enum values and can refactor them to use proper enum references. Includes tools for normalizing enum case names to UPPERCASE.

Features
--------

[](#features)

- 🔄 **Automatic Sync** – Runs during `npm run dev` and `npm run build` via the Vite plugin
- 🧭 **Wayfinder-Level DX** – One install command to scaffold everything
- 🏷️ **Labels Support** – `label()` or static `labels()` become TS maps
- 🎨 **Custom Methods** – Public zero-arg scalar methods become TS maps
- 📦 **Barrel Exports** – Optional `index.ts` for clean imports
- ⚡ **Smart Caching** – Only regenerate changed files using hashes
- 🔒 **Git-Friendly** – `.gitkeep` and strict `.gitignore` patterns supported
- 🔧 **Refactor Command** – Scan and fix hardcoded enum values in your codebase
- 🔠 **Key Normalization** – Convert enum keys to UPPERCASE and update all references

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

[](#requirements)

- PHP 8.2+
- Laravel 10, 11, or 12
- Node.js 18+
- Vite 4, 5, 6, or 7

Package Links
-------------

[](#package-links)

- [Composer](https://packagist.org/packages/devwizardhq/laravel-enumify)
- [NPM](https://www.npmjs.com/package/@devwizard/vite-plugin-enumify)

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

[](#installation)

### 1) Install the Laravel package

[](#1-install-the-laravel-package)

```
composer require devwizardhq/laravel-enumify
```

### 2) Run the install command

[](#2-run-the-install-command)

```
php artisan enumify:install
```

This will:

- Create `resources/js/enums/`
- Create `resources/js/enums/.gitkeep`
- Print the `.gitignore` lines to add (and offer to append them)
- Offer to publish the config file

### 3) Configure Vite

[](#3-configure-vite)

If the installer successfully installed the plugin, you just need to add it to your `vite.config.js`:

```
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import enumify from "@devwizard/vite-plugin-enumify";

export default defineConfig({
    plugins: [
        enumify(),
        laravel({
            input: ["resources/js/app.ts"],
            refresh: true,
        }),
    ],
});
```

If the automatic installation skipped or failed, manually install the plugin:

```
npm install @devwizard/vite-plugin-enumify --save-dev
# or
pnpm add -D @devwizard/vite-plugin-enumify
# or
yarn add -D @devwizard/vite-plugin-enumify
```

Usage
-----

[](#usage)

### Basic Enum

[](#basic-enum)

```
// app/Enums/OrderStatus.php
