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

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

A custom Doctrine type that maps column values to enum objects using myclabs/php-enum

Frequently asked questions about Doctrine Enum Type
Can I use acelaya/doctrine-enum-type in a pure Laravel/Eloquent app without Doctrine?
No, this package requires Doctrine ORM. If you're using Eloquent, consider Spatie’s Laravel Enums or PHP 8.1’s native enums instead. Only adopt Doctrine (via spatie/laravel-doctrine) if you need its advanced features like DDD or complex queries.
Does this package support PHP 8.1+ native enums?
No, it relies on the deprecated myclabs/php-enum. For PHP 8.1+, use Doctrine’s built-in enum support or alternatives like ramsey/uuid-style enums. This package is now largely obsolete for modern Laravel setups.
How do I install acelaya/doctrine-enum-type with Laravel and Doctrine?
Run `composer require acelaya/doctrine-enum-type` and ensure Doctrine ORM is installed (e.g., via spatie/laravel-doctrine). Configure Doctrine in your `config/doctrine.php` to register the `PhpEnumType` for your enum fields.
Will this work with Doctrine DBAL 3.0 and Symfony 6.x?
Yes, the package now supports Doctrine DBAL 3.0, making it compatible with Symfony 6.x or Laravel apps using spatie/laravel-doctrine. However, test thoroughly with your specific Doctrine ORM version (e.g., 2.10 vs. 3.x).
Can I use dynamic enums (runtime-defined values) with this package?
No, this package requires enums to be predefined in the database (e.g., MySQL ENUM columns). Dynamic enums won’t work—use application-level validation with VARCHAR columns instead.
What databases support this package’s enum mapping?
MySQL and PostgreSQL support native ENUM types, so they work seamlessly. SQLite has limited ENUM support (use TEXT + validation), and SQL Server requires VARCHAR with app-level checks.
Is acelaya/doctrine-enum-type actively maintained?
No, the package was archived in 2021. While it now supports DBAL 3.0, there are no guarantees for future PHP 8.x/Doctrine 3.x compatibility. Consider maintained alternatives like doctrine/doctrine-enum-bundle for long-term projects.
How do I migrate from Eloquent enums to Doctrine enums with this package?
Audit your Eloquent models for enum usage, then refactor entities to use Doctrine. Update migrations to define ENUM columns, and replace model properties with Doctrine-mapped enums. Test queries and repositories thoroughly.
Are there performance overheads for enum hydration/dehydration?
Yes, there’s minor overhead compared to native types. Benchmark in high-throughput systems, especially if enums are used frequently. For critical paths, consider native PHP 8.1 enums or simpler VARCHAR columns.
Does this package integrate with Laravel’s IDE tools (e.g., PHPStorm autocompletion)?
No, IDE support is limited. You’ll need manual type hints for enums. For better tooling, use PHP 8.1 native enums or Spatie’s Laravel Enums, which integrate seamlessly with modern IDEs.
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