yeugone/enum-bundle
yeugone/enum-bundle is a PHP package for Laravel developers seeking a cleaner way to organize and work with enums. It bundles practical enum utilities that help define type-safe values, reduce scattered constants, and keep application code more structured and readable across your project.
Architecture fit. The package is a Symfony bundle, not a Laravel package — it splits into a framework-agnostic core enumeration library plus a Symfony glue layer (Bundle class, DI extension, compiler passes, and likely optional integration points for Form, Validator, Twig, and Doctrine). For a Laravel estate, only the core is a candidate; the bundle layer is inert. Fit is therefore conditional: reasonable if you want a typed, discoverable enum abstraction with conventions baked in, weak if you're on PHP 8.1+, where native backed enums already cover roughly 80% of the requirement.
Integration feasibility. Composer-installable, PSR-4, MIT, small surface area. A one-day spike is realistic. The blocker is not effort but evidence: 12 stars and zero dependents means no production reference implementations, no Stack Overflow corpus, and no third-party glue you can copy. You would be the first integrator in a non-Symfony context.
Technical risk.
enum).Key questions. Does it wrap or predate PHP 8.1 native enums? Is the core installable standalone without symfony/framework-bundle? What is the serialization contract (string-backed, int-backed, object)? Does it ship a Doctrine type — and would we need an equivalent Eloquent cast? What is the PHP floor and CI matrix? Test coverage and static-analysis level? Is the dependency SemVer-stable? Roughly how many files, i.e. is vendoring trivial?
Stack fit. Laravel does not consume Symfony bundles. Realistic paths, in order of preference: (a) depend only on the core library and wire validation via Rule::in, Eloquent casts, and config; (b) use bare classes with no framework glue at all — often sufficient for const-map enums; (c) reject and use native enums with a small internal helper.
Migration path. Inventory candidate domains (status, type, role, currency) → pilot one enum in a bounded context → map to Eloquent cast, form request validation, and DB column type → codemod consumers off ad-hoc string constants → deprecate. If your roadmap already points to native enums, go there directly; adopting this package as an interim layer means paying for two migrations.
Compatibility. Verify the PHP floor against your runtime (Laravel 10/11/12 implies 8.1/8.2+). Diff the Composer dependency tree before and after install — the most likely failure is a transitive Symfony constraint that breaks a routine composer update later. Also check for Doctrine ORM coupling, which is a hard no in most Laravel apps.
Sequencing. Week 0: spike one enum end-to-end (request → cast → API resource) plus dependency-tree diff. Week 1: decision gate — adopt core-only, vendor, or reject. If adopting, hide it behind an internal App\Support\Enum facade so the dependency stays swappable, and keep it out of public API contracts until the serialization behavior is pinned by tests.
Maintenance. MIT and forkable, likely small enough to vendor or absorb into an internal package within a week. That converts external risk into owned code — usually correct at this adoption level. Budget a one-time fork-and-diff plus a quarterly upstream review.
Support. Effectively none. No community triage, no tutorials, no issue-tracker velocity. Assume self-support from day one and write that assumption into the ADR; the vendor is a direct channel, not a support contract.
Scaling. Runtime cost is negligible (const maps, in-memory). The scaling concern is organizational: every enum becomes a cross-team contract, and without a registry you get OrderStatus / OrderState drift. Mitigate with one canonical enum namespace and a naming convention enforced in review.
Failure modes. (1) Upstream archive — mitigated by vendoring. (2) Transitive Symfony constraint blocking a Laravel upgrade — the most probable incident, surfacing as a Composer resolution failure during an unrelated update. (3) Serialization drift across minor versions leaking into stored data or API responses. (4) Semantic divergence from native enums causing subtle === / in_array bugs. Each needs an explicit regression test.
Ramp-up. Low technically — half a day to read, one day to pilot. The real cost is the convention decision (persistence, serialization, validation, translation), which is an architecture call, not a library call, and should not be delegated to the package.
Recommendation: conditional hold. Strong fit only for a pre-8.1 baseline or a genuine Symfony integration need. For a Laravel shop on 8.1+, native backed enums plus ~100 lines of internal helpers deliver more value with zero supply-chain exposure. If adopted, take the core only, vendor it, and hide it behind a facade.
How can I help you explore Laravel packages today?