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.
spatie/laravel-doctrine or Symfony integration) for type-safe enums. No change—still a poor fit for native Eloquent unless Doctrine is explicitly adopted.spatie/laravel-doctrine).myclabs/php-enum (deprecated in favor of PHP 8.1+ native enums or ramsey/uuid-style enums). No change—may still need polyfills or migration.ENUM('value1', 'value2')), limiting flexibility for dynamic enums.ENUM types.ramsey/uuid-style enums or Spatie’s Laravel Enums instead.doctrine/doctrine-enum-bundle) preferable?spatie/laravel-doctrine or Symfony components, now with DBAL 3.0 support.Spatie/laravel-enum or native PHP 8.1 enums instead.ENUM support.ENUM support (may need workarounds like TEXT + validation).VARCHAR with application-level validation.doctrine/dbal:^3.0).doctrine/orm + acelaya/doctrine-enum-type.config/doctrine.php (if using Spatie’s package).use Acelaya\DoctrineEnumType\Type\EnumType;
use Myclabs\Enum\Enum;
#[ORM\Entity]
class UserStatus implements Enum
{
public const ACTIVE = 'active';
public const INACTIVE = 'inactive';
}
#[ORM\Entity]
class User
{
#[ORM\Column(type: EnumType::NAME, enumClass: UserStatus::class)]
private UserStatus $status;
}
ENUM types (or VARCHAR with validation).ALTER TABLE users MODIFY status ENUM('active', 'inactive');
myclabs/php-enum (v1.8.x). Conflicts with PHP 8.1+ enums.UserRole, OrderStatus).myclabs/php-enum for security updates (though inactive).ramsey/uuid-style enums if issues arise.ClassMetadataInfoException) may be less intuitive than Eloquent’s.doctrine/orm profiling).ENUM types improve validation but may not index as efficiently as VARCHAR.| Failure Scenario | Impact | Mitigation |
|---|---|---|
Database ENUM value mismatch |
Query failures, data corruption | Use VARCHAR + application validation |
| Doctrine metadata cache corruption | Enum hydration fails | Clear cache (php bin/console cache:clear) |
| PHP 8.1+ |
How can I help you explore Laravel packages today?