Weave Code
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 Type Laravel Package

acelaya/doctrine-enum-type

Doctrine DBAL type for mapping MyCLabs\Enum\Enum values to entity columns. Provides a reusable PhpEnumType to register enums as custom Doctrine types. Note: largely obsolete now that PHP has native enums and Doctrine supports them.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Database-Driven Enums: Enables storing enums as database columns (e.g., status, priority) while maintaining type safety and autocompletion in PHP, reducing manual validation and improving developer experience.
  • Schema Evolution: Simplifies database migrations for enum-like fields (e.g., adding/removing values) without breaking application logic.
  • Build vs. Buy: Avoids reinventing enum serialization/deserialization logic for Doctrine, saving dev time and reducing technical debt.
  • Use Cases:
    • Admin Panels: Replace hardcoded strings (e.g., "active", "pending") with strongly typed enums for better maintainability.
    • APIs: Standardize enum handling across frontend/backend (e.g., GraphQL, REST) with consistent database storage.
    • Legacy Systems: Retrofit enums to existing Doctrine-based applications without major refactoring.
    • Modern Doctrine Stack: Supports Doctrine DBAL 3.0, aligning with newer Laravel/Doctrine ecosystems (e.g., Symfony 5.4+).
  • Roadmap Alignment: Supports future-proofing for projects adopting PHP 8.1+ enums or migrating from legacy string-based state management, while ensuring compatibility with updated dependency stacks.

When to Consider This Package

  • Adopt if:
    • Your app uses Doctrine ORM and needs type-safe enums in database columns.
    • You’re tired of magic strings (e.g., "DRAFT", "PUBLISHED") in queries/validations.
    • Your team prioritizes developer productivity (autocompletion, refactoring safety) over minimal setup.
    • You’re not using PHP 8.1+ enums natively (this package bridges myclabs/php-enum to Doctrine).
    • You’re using Doctrine DBAL 3.0 (e.g., Symfony 5.4+, Laravel with updated Doctrine bundles) and need compatibility.
  • Look elsewhere if:
    • You’re not using Doctrine ORM (e.g., Eloquent, raw SQL, or another ORM).
    • Your enums are simple (e.g., 2–3 values) and don’t need database persistence.
    • You’re on PHP 8.1+ and prefer native enums (though this package still offers Doctrine integration).
    • Your project has strict backward compatibility constraints (last release was 2021; evaluate maintenance risk despite DBAL 3.0 support).
    • You need active maintenance (package is archived; fork or maintain locally).

How to Pitch It (Stakeholders)

For Executives: "This package lets us store enums directly in the database—like a ‘status’ column that’s always ‘ACTIVE’, ‘PENDING’, or ‘ARCHIVED’—instead of strings that can break or change unpredictably. The latest update adds support for Doctrine DBAL 3.0, ensuring compatibility with modern Laravel/Symfony stacks. It’s a small investment now that’ll save us time on bugs, migrations, and onboarding devs later. Think of it as adding ‘autopilot’ for a common but error-prone part of our codebase—with fewer compatibility risks."

For Engineers: *"We’re updating to v2.5.0 of doctrine-enum-type to:

  • Gain DBAL 3.0 support (critical if we’re upgrading Symfony/Laravel Doctrine bundles).
  • Leverage automated CI/CD (migrated to GitHub Actions, though the package remains archived).
  • Prototype enum-driven fields (e.g., order_status, user_role) with type safety and IDE autocompletion. Tradeoffs: The package is unmaintained, but the DBAL 3.0 update reduces friction for modern setups. Let’s test it on a non-critical table first (e.g., post_status)."*

For Developers: "Imagine your User entity has a role field. Instead of storing 'admin' as a string and hoping it’s always correct, we’ll define a UserRole enum with ADMIN, EDITOR, etc. The database column stays a string under the hood, but PHP treats it like a proper enum. Bonus: The latest version works with Doctrine DBAL 3.0, so it’ll play nice with newer Laravel/Symfony setups. Less validation code, fewer bugs, and easier refactoring. Want to try it on the post_status field next sprint?"

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.
bugban/php-sdk
littlerocket/job-queue-bundle
graham-campbell/flysystem
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
directorytree/opensearch-client
directorytree/opensearch-adapter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php