{"id":37381166,"url":"https://github.com/devwizardhq/vite-plugin-enumify","last_synced_at":"2026-04-12T07:02:06.899Z","repository":{"id":332727205,"uuid":"1134699789","full_name":"DevWizardHQ/vite-plugin-enumify","owner":"DevWizardHQ","description":"Vite plugin for Laravel Enumify - auto-sync PHP enums to TypeScript","archived":false,"fork":false,"pushed_at":"2026-04-09T23:47:00.000Z","size":277,"stargazers_count":6,"open_issues_count":4,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-10T01:28:20.632Z","etag":null,"topics":["enum","php-enum","ts-enum-util","vite"],"latest_commit_sha":null,"homepage":"https://devwizardhq.github.io/vite-plugin-enumify/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DevWizardHQ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"DevWizard"}},"created_at":"2026-01-15T04:31:35.000Z","updated_at":"2026-04-09T23:45:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/DevWizardHQ/vite-plugin-enumify","commit_stats":null,"previous_names":["devwizardhq/vite-plugin-enumify"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/DevWizardHQ/vite-plugin-enumify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevWizardHQ%2Fvite-plugin-enumify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevWizardHQ%2Fvite-plugin-enumify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevWizardHQ%2Fvite-plugin-enumify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevWizardHQ%2Fvite-plugin-enumify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevWizardHQ","download_url":"https://codeload.github.com/DevWizardHQ/vite-plugin-enumify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevWizardHQ%2Fvite-plugin-enumify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31706765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-12T06:22:27.080Z","status":"ssl_error","status_checked_at":"2026-04-12T06:21:52.710Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["enum","php-enum","ts-enum-util","vite"],"created_at":"2026-01-16T05:08:17.030Z","updated_at":"2026-04-12T07:02:06.893Z","avatar_url":"https://github.com/DevWizardHQ.png","language":"TypeScript","readme":"# @devwizard/vite-plugin-enumify\n\n[![NPM Version](https://img.shields.io/npm/v/@devwizard/vite-plugin-enumify.svg?style=flat-square)](https://www.npmjs.com/package/@devwizard/vite-plugin-enumify)\n[![NPM Downloads](https://img.shields.io/npm/dt/@devwizard/vite-plugin-enumify.svg?style=flat-square)](https://www.npmjs.com/package/@devwizard/vite-plugin-enumify)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/devwizardhq/laravel-enumify.svg?style=flat-square)](https://packagist.org/packages/devwizardhq/laravel-enumify)\n[![Packagist Downloads](https://img.shields.io/packagist/dt/devwizardhq/laravel-enumify.svg?style=flat-square)](https://packagist.org/packages/devwizardhq/laravel-enumify)\n[![GitHub](https://img.shields.io/badge/repo-devwizardhq%2Flaravel--enumify-181717?style=flat-square\u0026logo=github)](https://github.com/devwizardhq/laravel-enumify)\n\nVite plugin for [Laravel Enumify](https://github.com/devwizardhq/laravel-enumify) — automatically sync PHP enums to TypeScript during development and builds.\n\n## Features\n\n- Runs `php artisan enumify:sync --force --quiet` before Vite compiles\n- Watches enum directories in dev mode (debounced)\n- Reads `config/enumify.php` to discover paths and watch config\n- Ignores changes inside the output directory to avoid infinite loops\n- Cross-platform: Windows/macOS/Linux\n\n## Package Links\n\n- NPM: https://www.npmjs.com/package/@devwizard/vite-plugin-enumify\n- Repository: https://github.com/devwizardhq/laravel-enumify\n- Composer (Laravel package): https://packagist.org/packages/devwizardhq/laravel-enumify\n\n## Installation\n\n```bash\nnpm install @devwizard/vite-plugin-enumify --save-dev\n# or\npnpm add -D @devwizard/vite-plugin-enumify\n# or\nyarn add -D @devwizard/vite-plugin-enumify\n```\n\n## Package Manager Support\n\nThis plugin is package-manager agnostic and works with npm, pnpm, or yarn. The runtime behavior is identical regardless of how you install it.\n\n## Usage\n\nAdd the plugin to your `vite.config.ts`:\n\n```ts\nimport { defineConfig } from \"vite\";\nimport laravel from \"laravel-vite-plugin\";\nimport enumify from \"@devwizard/vite-plugin-enumify\";\n\nexport default defineConfig({\n  plugins: [\n    enumify(),\n    laravel({\n      input: [\"resources/js/app.ts\"],\n      refresh: true,\n    }),\n  ],\n});\n```\n\n## How It Works\n\n1. **On Build Start**: runs `php artisan enumify:sync --force --quiet` before Vite compiles TypeScript.\n2. **Watch Mode**: watches the enum paths from `config/enumify.php` and re-syncs on changes.\n3. **Safe Output**: ignores changes under the output directory to avoid re-trigger loops.\n\n## Options\n\n```ts\nenumify({\n  // PHP binary path (default: \"php\")\n  artisanBin: \"php\",\n\n  // Path to the artisan file (default: \"artisan\")\n  artisanFile: \"artisan\",\n\n  // Command to run (default: \"enumify:sync\")\n  syncCommand: \"enumify:sync\",\n\n  // Working directory (default: process.cwd())\n  cwd: process.cwd(),\n\n  // Enable watch mode in development (default: runtime.watch from config/enumify.php)\n  watch: true,\n\n  // Additional environment variables\n  env: {},\n});\n```\n\nThe plugin reads `config/enumify.php` to discover enum paths and output paths so it can watch the right files and avoid feedback loops.\n\n## Example\n\nGiven this PHP enum:\n\n```php\n// app/Enums/OrderStatus.php\nenum OrderStatus: string\n{\n    case PENDING = 'pending';\n    case PROCESSING = 'processing';\n    case SHIPPED = 'shipped';\n\n    public function label(): string\n    {\n        return match ($this) {\n            self::PENDING =\u003e 'Pending',\n            self::PROCESSING =\u003e 'Processing',\n            self::SHIPPED =\u003e 'Shipped',\n        };\n    }\n\n    public function color(): string\n    {\n        return match ($this) {\n            self::PENDING =\u003e 'yellow',\n            self::PROCESSING =\u003e 'blue',\n            self::SHIPPED =\u003e 'green',\n        };\n    }\n}\n```\n\nThe plugin generates:\n\n```ts\n// resources/js/enums/order-status.ts\nexport const OrderStatus = {\n  PENDING: \"pending\",\n  PROCESSING: \"processing\",\n  SHIPPED: \"shipped\",\n} as const;\n\nexport type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];\n\nexport const OrderStatusUtils = {\n  label(status: OrderStatus): string {\n    switch (status) {\n      case OrderStatus.PENDING:\n        return \"Pending\";\n      case OrderStatus.PROCESSING:\n        return \"Processing\";\n      case OrderStatus.SHIPPED:\n        return \"Shipped\";\n    }\n  },\n\n  color(status: OrderStatus): string {\n    switch (status) {\n      case OrderStatus.PENDING:\n        return \"yellow\";\n      case OrderStatus.PROCESSING:\n        return \"blue\";\n      case OrderStatus.SHIPPED:\n        return \"green\";\n    }\n  },\n\n  options(): OrderStatus[] {\n    return Object.values(OrderStatus);\n  },\n};\n```\n\n## Git Workflow\n\n1. Create a feature branch from `main`\n2. Make changes with focused commits\n3. Run `npm run build` and `npm run typecheck`\n4. Open a PR and ensure CI passes\n\nRelease tip: tag releases after merging to `main`, then publish to NPM.\n\n## Requirements\n\n- Node.js \u003e= 18.0.0\n- Vite \u003e= 4.0.0 (including Vite 7)\n- PHP \u003e= 8.2\n- Laravel Enumify package installed\n\n## License\n\nMIT\n","funding_links":["https://github.com/sponsors/DevWizard"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevwizardhq%2Fvite-plugin-enumify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevwizardhq%2Fvite-plugin-enumify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevwizardhq%2Fvite-plugin-enumify/lists"}