- How do I install assoconnect/doctrine-types-bundle in a Laravel application?
- Install it with Composer using composer require assoconnect/doctrine-types-bundle. It is a Symfony bundle, so there is no native Laravel service provider; register the Doctrine DBAL types in your laravel-doctrine configuration or DBAL type map. Use the Symfony validation integration only if Symfony Validator is already available in your stack.
- Can I use assoconnect/doctrine-types-bundle with Laravel without Doctrine ORM?
- Yes, the core value is Doctrine DBAL custom types, which can be registered through a laravel-doctrine DBAL bridge or a raw doctrine/dbal connection. You can use the types for schema mapping and value conversion without adopting Doctrine ORM entities. Validation constraints still require separate translation to Laravel rules or custom validators.
- Which Laravel and PHP versions are supported?
- The package is aligned with PHP 8.4+ and Laravel 10+ compatibility through Doctrine DBAL according to the assessment. Since it is not a Laravel-native package, actual support depends on your laravel-doctrine bridge and Doctrine DBAL version. Verify Composer constraints and the CI matrix before upgrading.
- How do I configure custom Doctrine types like IBAN, BIC, or Money in Laravel?
- Add entries to your Doctrine DBAL types map, for example iban mapped to IbanType::class, bic mapped to BicType::class, and money mapped to MoneyType::class. For ORM entities, reference the registered type name in column mappings. In Laravel this typically lives in config/doctrine.php or a service provider that configures the DBAL connection.
- Does this package replace Laravel validation rules for email, phone, or IBAN?
- No. It integrates Symfony Validation constraints with Doctrine custom types, and Laravel's Illuminate Validation is not natively supported. You must translate Symfony constraints to Laravel rules or custom validators. The DBAL types handle database mapping and conversion, not Laravel request validation by themselves.
- What types are included for Spanish, Dutch, and Italian compliance?
- The bundle includes SpanishNifType, DutchKvkNumberType with 8 digits, and ItalianFiscalCodeType documented as 11 digits. The Italian type length matches an Italian Partita IVA or VAT number rather than the 16-character codice fiscale, so verify semantics before using it for tax-ID validation. These locale types are additive and non-breaking in v2.18.0.
- Does assoconnect/doctrine-types-bundle support nullable fields?
- Yes, the bundle explicitly supports nullable and non-nullable Doctrine fields. The custom DBAL types can convert null values without forcing a value. You should still configure column nullable settings in your entity mapping or migrations.
- Is this package maintained and production-ready?
- The assessment notes active maintenance signals such as PHPUnit 10, CI/CD upgrades, and a low-friction additive v2.18.0 release. It is a Symfony bundle with a narrow DBAL type focus, so production risk is mainly tied to your Doctrine integration layer. Pin versions and review the changelog for new locale types.
- What are alternatives to using this bundle in a Laravel app?
- You can implement custom Laravel validation rules and Eloquent casts for IBAN, BIC, money, phone, and locale fields. Alternatively, use a dedicated validation library or keep Doctrine DBAL types only where you already have Doctrine. This bundle is most useful when you want centralized Doctrine type mapping and already accept Doctrine dependencies.
- How do I test these Doctrine custom types in Laravel?
- Use an in-memory SQLite or test database with Doctrine DBAL configured and assert conversion to and from database values for each type. Add unit tests for nullable fields and invalid values such as malformed IBANs or wrong-length Dutch KVK numbers. If you translate Symfony constraints to Laravel rules, test those rules separately.