Download the PHP package olivermbs/enumshare without Composer
On this page you can find all versions of the php package olivermbs/enumshare. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download olivermbs/enumshare
More information about olivermbs/enumshare
Files in olivermbs/enumshare
Package enumshare
Short Description A Laravel package to export PHP Enums to TypeScript with labels, metadata, and type-safe frontend access
License MIT
Homepage https://github.com/olivermbs/enumshare
Informations about the package enumshare
Enumshare
A Laravel package to export PHP Enums to TypeScript. Simple, type-safe, zero runtime dependencies.
Installation
Quick Start
1. Create your enum
Any PHP enum can be exported - no trait required.
2. Export
3. Use in TypeScript
Generated Output
↓ Generates ↓
Output Modes
Configure the output mode in config/enumshare.php:
Full (default)
Includes labels, meta, lookup maps, type guards, and utility methods.
Minimal
Simple output - just values and types (~10 lines per enum):
Configuration
Commands
Attributes
| Attribute | Description |
|---|---|
#[Label('Text')] |
Static label |
#[TranslatedLabel('key')] |
Translation key |
#[Meta(['key' => 'value'])] |
Metadata |
#[ExportMethod] |
Export method result |
Note: Enums are keyed by short name (class basename). Duplicate names across namespaces will cause a collision error.
Auto-Regeneration with Vite
For automatic regeneration during development, install Laravel Wayfinder:
Then configure Vite to watch your enum files:
Note: Wayfinder is optional - only needed for auto-regeneration. You can always run
php artisan enums:exportmanually.
Testing
License
MIT
All versions of enumshare with dependencies
illuminate/contracts Version ^11.0||^12.0
illuminate/console Version ^11.0||^12.0
symfony/finder Version ^6.0||^7.0