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

Doctrine Enum Bundle Laravel Package

art-fatal/doctrine-enum-bundle

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Type Safety & Code Quality: Enables strict, self-documenting enums in PHP 8.1+ projects, reducing runtime errors and improving developer experience.
  • Database Schema Alignment: Automatically maps PHP enums to MySQL ENUM columns, enforcing data integrity at the database level.
  • Developer Productivity: Reduces boilerplate with the make:enum command, accelerating feature development for statuses, states, or categorization logic.
  • Roadmap for Symfony Projects: Ideal for greenfield projects or migrations to Symfony 6/7, where enums are a natural fit for domain modeling.
  • Build vs. Buy: Justifies avoiding custom solutions or third-party libraries with similar functionality (e.g., manual enum-to-DBAL mappings).
  • Use Cases:
    • User roles/permissions (e.g., ADMIN, EDITOR).
    • Order states (e.g., PENDING, SHIPPED, CANCELLED).
    • Domain-specific categorizations (e.g., DayOfWeek for scheduling).
    • Validation-heavy fields (e.g., dropdowns in forms).

When to Consider This Package

  • Avoid if:
    • Your project uses PHP < 8.1 (BackedEnum is unavailable).
    • You’re not using Symfony (or Doctrine DBAL) or need PostgreSQL/other DB support (this is MySQL-focused).
    • You require complex enum logic (e.g., hierarchical enums) beyond basic CRUD—consider a dedicated library like Spatie/Enum.
    • Your team prefers runtime enums (e.g., const classes) over compile-time safety.
  • Look elsewhere if:
    • You need multi-database support (e.g., PostgreSQL’s text type for enums).
    • Your project is non-Symfony (e.g., Laravel, plain PHP)—this bundle is Symfony-specific.
    • You’re constrained by low-starred packages (0 stars may indicate unproven reliability; evaluate alternatives like Spatie/Enum or Webmozart/Assert).

How to Pitch It (Stakeholders)

For Executives: "This bundle lets us use PHP’s native enums (introduced in PHP 8.1) to enforce data consistency—both in code and the database. For example, a UserStatus enum ensures only ACTIVE, INACTIVE, or BANNED values exist in our system, reducing bugs and improving performance. It’s zero-configuration, auto-generates database columns, and speeds up development with a make:enum command. Think of it as ‘enums on steroids’ for Symfony projects—cleaner code, fewer errors, and happier developers."

For Engineers: *"This solves the pain of manually mapping PHP enums to Doctrine types. Key benefits:

  • Auto-registration: No manual Doctrine type setup—just extend EnumType and go.
  • MySQL ENUM support: Database-level validation for free.
  • Built-in helpers: Ready-to-use enums like DayOfWeek with methods like isWeekend().
  • Generator tool: make:enum creates enum + type files in seconds.
  • Type safety: IDE autocompletion and refactoring support out of the box. Perfect for statuses, states, or categorizations—just install, extend, and use. Examples included for quick adoption."
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.
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support