Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Enums For Laravel Laravel Package

roundly-consulting/enums-for-laravel

Enums for Laravel brings first-class PHP enum support to Laravel applications. Cast enum attributes in Eloquent models, validate enum input, and work with backed values across requests and APIs. It keeps code type-safe, readable, and easy to integrate without extra boilerplate.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package is a thin convenience layer over native PHP 8.1+ enums, targeting four seams in a Laravel app: Eloquent attribute casting, form-request validation, API resource serialization, and enum label/description localization, plus Artisan generators for scaffolding. Architecturally that is a low-coupling, additive dependency — it does not own a subsystem, register service providers that alter request lifecycle, or impose a data model. It sits in the same layer as Laravel's own Illuminate\Validation\Rules\Enum and enum casts, which is the central evaluation problem: most of the advertised surface is already native. Laravel 9+ supports enum casts in $casts and Rule::enum() in validation; backed enums serialize to scalars in JSON resources by default. The genuine delta appears to be localized labels/descriptions, generator consistency, and possibly null-safe/fromName helpers. Action: require a written feature-by-feature delta against the framework baseline before adoption — if the delta is two helper methods and a generator stub, the architecture fit is technically fine but the business case is weak.

Integration feasibility. Low effort. Composer install, no infrastructure, no data migration, no queue or cache implications. A competent Laravel engineer can integrate and validate in one to three days for a pilot domain. The real cost is not integration but convention debt: once enums carry labels via a vendor interface, every enum and every Blade/JSON presentation path becomes coupled to that vendor's contract.

Technical risk.

  • Adoption risk (high). 5 stars, 0 dependents, no ecosystem validation, no third-party security review, no evidence of production usage. There is no signal that this survives its maintainer's attention.
  • Bus factor / governance (high). Effectively a single-organization package (roundly-consulting) with no visible contributor base, no stated support policy, no published deprecation or LTS posture.
  • Release integrity (medium). The listed last release of 2026-10-10 is anomalous relative to the current date. Verify the Packagist tag, its commit SHA, whether the tag is signed, and whether the changelog matches the tag. Treat this as a data-quality flag until confirmed; a mistagged or unpublished release is a supply-chain question, not a paperwork one.
  • API stability (medium). A pre-1.0 or low-adoption package has no social pressure against breaking changes. Pin exact versions and read the diff of every upgrade.
  • Duplication/divergence (medium). Native Laravel enum support is advancing each major release. A wrapper risks drifting from the framework's idioms, leaving you with two ways to cast and validate enums in one codebase.
  • Data-integrity risk (low but real). Enum casts raise on unknown persisted values; changing an enum case is a de facto schema change. The package does not solve this — it only makes it more ergonomic, which can increase the rate of such changes.

Key questions for the maintainer / evaluation spike.

  1. Which Laravel and PHP versions are in the CI matrix, and is the matrix tested or merely declared in composer.json?
  2. Does the casting implementation wrap or replace Laravel's native enum cast? Does it handle nullable columns, BackedEnum vs pure enums, and tryFrom fallbacks?
  3. What is the localization mechanism — lang files keyed by enum, interface methods on the enum, or config? What happens on a missing key (exception, key echo, fallback)?
  4. Is there a documented semver policy, and what is the maintainer's stated response expectation for issues and security reports?
  5. What is the test coverage and static-analysis level (PHPUnit/Pest, PHPStan/Psalm baseline), and is CI green on the default branch?
  6. What is the license and contribution model — MIT is permissive, but can we fork and patch internally without friction if the package stalls?

Integration Approach

Stack fit. Correct fit for a Laravel 10/11 monolith or modular monolith on PHP 8.1+, where enums are already the team's chosen representation for status, type, and category fields. Poor fit for a polyglot or API-first service where Laravel is peripheral, and irrelevant for pre-8.1 runtimes. Because it is a single Composer dependency with no runtime services, the blast radius of removal is bounded to the files that reference its interfaces.

Migration path. Adopt additively, never as a refactor program:

  1. Spike (1–2 days): install in a branch, implement one real enum end-to-end (cast, validate, serialize, localize), and diff against the native-only implementation. Produce the delta document and a go/no-go.
  2. Pilot (1 sprint): apply to one bounded context with a small enum count. Instrument nothing; there is no runtime surface worth instrumenting. Success criterion is developer-experience and code-review signal, not performance.
  3. Convention (post-pilot): if adopted, publish an ADR and a short internal style note — enums implement the vendor contract; validation uses whichever rule is canonical; new enums are scaffolded with the generator. Enforce with a code-review checklist, not a static rule.
  4. Contingency seam: if label/localization support is the driver, ensure your enums implement a project-owned interface (App\Contracts\HasLabel) that the vendor contract extends, or wrap access behind a small presenter. This costs an hour and converts a vendor risk into a one-file replacement.
  5. Retrofit (optional, low priority): migrate existing enums opportunistically when touched. Do not batch-migrate; the change is cosmetic and the churn is not worth the review load.

Compatibility. Pin to an exact version in composer.json and lockfile-commit it. Confirm the package's Laravel constraint against your upgrade cadence — a package this small is unlikely to be updated promptly for a new Laravel major, and an incompatible constraint will block your framework upgrade, which is a far larger cost than the package saves. Test the package's behavior on your actual database: nullable enum columns and legacy rows containing values outside the enum are the two failure paths most likely to surface late.

Sequencing (relative to other work). Adopt after the framework is on a supported major and after the team has standardized on enums generally; adopting both at once makes it impossible to attribute problems. Do not sequence this ahead of anything with user-facing impact.

Operational Impact

Maintenance. Expect to own it. The realistic posture is "vendored dependency with upstream": consume releases slowly, review diffs, and hold a standing option to fork under MIT. Budget a small recurring allowance — a few hours per quarter — for review, version bumps, and the framework-major compatibility check. If the maintainer goes quiet, the fork path is credible because the code surface is small; confirm that during the spike by reading the source, not by trusting the README.

Support. No SLA, no vendor contract, community-only issue triage with a 5-star project implying effectively no user base to crowdsource answers. Internal support falls to whoever owns the integration. That person should be named explicitly and documented, otherwise the package becomes orphaned knowledge the moment they change teams.

Scaling. Runtime cost is negligible — helpers on enum instances, no queries, no I/O, no caching layer. Watch two second-order effects at scale: (a) if label localization loads translation files per enum instance in a hot loop, confirm it uses the framework's already-loaded translator and does not re-read from disk; (b) label-driven presentation in list endpoints can tempt developers into per-row lookups, producing N+1 patterns that have nothing to do with the package but will be blamed on it. Both are review concerns, not capacity concerns.

Failure modes.

  • Silent divergence: two enum-casting idioms coexist in the codebase; new hires pick the wrong one. Mitigation: ADR plus review checklist.
  • Persisted-value drift: an enum case is renamed or removed; existing rows fail to hydrate with a ValueError at read time, often in production first. Mitigation: treat enum case changes as schema changes requiring a backfill migration and a data audit query.
  • Localization gaps: missing translation keys surface as raw keys or exceptions in customer-facing responses; this is the package's highest-visibility failure because it lands in output. Mitigation: a CI check asserting every enum case has a label in every supported locale.
  • Serialization contract change: a presentation helper changes scalar vs object shape in an API response. Mitigation: contract tests on API resources, and version the response shape.
  • Upgrade deadlock: a Laravel major arrives and the package has no compatible release. Mitigation: the project-owned interface seam described above, plus a documented "remove in one PR" path.
  • Supply chain: low-probability but unmitigated — no security review, single maintainer, small dependent base means no one else is watching. Mitigation: pin, review diffs, and run your standard dependency scanning.

Ramp-up. Low technical ramp — a Laravel developer familiar with enums is productive in under a day, and the package's concepts are a subset of the framework's. The real ramp cost is organizational: the team must learn the house convention (which cast, which validation rule, how labels are exposed) rather than the package API. Allocate half a day of documentation and one onboarding paragraph. Overall recommendation for a TPM: treat this as a convenience dependency with a mandatory build-vs-buy gate — approve only if the localization and generator features are concrete, near-term requirements that native Laravel does not cover; otherwise implement the small delta internally behind a project-owned interface and keep the framework upgrade path unblocked.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings