Weave 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 Types Bundle

Doctrine Types Bundle Laravel Package

assoconnect/doctrine-types-bundle

Symfony bundle integrating Symfony validation with Doctrine custom types (email, IBAN, BIC, SIREN/SIRET, phone, country, currency, money, locale, and more), eliminating duplicate validation code and supporting nullable and non-nullable fields.

View on GitHub
Deep Wiki
Context7

AssoConnectDoctrineTypesBundle is a Symfony 5 bundle that integrates the Symfony validation component with Doctrine entity custom types, eliminating duplicate validation code across your entities.

  • Ships ready-made Doctrine types such as Amount, Email, Iban, Phone, Country, Currency, and French Siren/Siret/RNA
  • Built-in Symfony validators enforce correctness at the type level
  • Supports both nullable and non-nullable fields out of the box
  • Covers 20+ domain-specific types, from Latitude/Longitude to Bic and Timezone
  • Simple registration keeps entity mappings clean and consistent
Frequently asked questions about Doctrine Types Bundle
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.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections