- Does okapon/doctrine-set-type-bundle work with Laravel?
- It is a Symfony bundle built around Symfony dependency injection and Doctrine2 ORM, so it does not integrate with Laravel out of the box. Laravel's default Eloquent layer has no concept of Symfony bundles, and even laravel-doctrine/orm does not consume Symfony bundle bootstrapping. You would need a maintained fork or a Laravel service provider that registers the DBAL type manually.
- How can I map a MySQL SET column to a PHP array in Laravel?
- If you use Eloquent, implement a custom cast or accessor and mutator that splits and joins comma-separated values and validates against the allowed set. If you use Doctrine in Laravel, register a small custom DBAL type instead of adopting this Symfony bundle. The bundle's core idea is useful, but the Symfony wiring is the part that does not fit Laravel.
- Can I install this bundle with Composer in a Laravel project?
- Composer may install it, but the Symfony bundle will not boot in a Laravel application because there is no Symfony kernel or bundle registration. You would still need to register the Doctrine type yourself and handle compatibility with modern DBAL versions. Installing it alone does not give you a working SET type in Laravel.
- Which Laravel and PHP versions are supported?
- There is no official Laravel support; the package is a Symfony bundle last released in 2017 for the Doctrine2 and Symfony 2-3 era. PHP 8.x and Doctrine DBAL 3 or 4 compatibility is unverified and likely broken. Treat any Laravel use as requiring a compatibility spike and possibly a fork.
- Is this package still maintained?
- The package is effectively abandoned, with a last release in 2017, around 11 stars, and zero dependents. MIT licensing lets you fork it, but you would own DBAL API updates, PHP version bumps, and security patches. There is no active vendor or community support to rely on.
- What are better alternatives to this bundle for Laravel?
- For Eloquent, use a custom cast, JSON column, normalized join table, ENUM, or bitmask depending on your query needs. For Doctrine in Laravel, write a small custom DBAL type and register it in a service provider. A normalized or JSON model is usually more portable and scalable than MySQL SET.
- How does the bundle validate SET values?
- It reads the allowed values from the MySQL column definition and uses them when converting between comma-separated database values and PHP arrays. That keeps hydration and persistence bidirectional without hand-rolled parsing. Validation behavior depends on the column definition being available and correct.
- Can I use this bundle with laravel-doctrine/orm?
- Not directly, because laravel-doctrine/orm provides Doctrine integration for Laravel but does not consume Symfony bundles. The useful part is the DBAL SET type logic, which you could port or reimplement as an application-level type. Registering that type in a Laravel service provider is simpler than adapting the bundle.
- What are the production risks of using MySQL SET columns?
- MySQL SET is limited to 64 distinct values, is MySQL-specific, and queries using FIND_IN_SET are generally non-sargable and can become a performance bottleneck. Strict SQL mode, schema diffs, and migrations can also mis-handle SET values. A normalized join table or JSON column scales better for evolving multi-value attributes.
- How do I migrate away from MySQL SET to JSON or a normalized table?
- First confirm whether SET is a hard requirement, then add the new column or table and backfill data from the comma-separated values. Update application casts, queries, and validation to use the new representation, test hydration and persistence thoroughly, and only then remove the old SET column. Plan the migration with schema diff and rollback checks because SET behavior can be order-sensitive.