Download the PHP package tourze/doctrine-indexed-bundle without Composer
On this page you can find all versions of the php package tourze/doctrine-indexed-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tourze/doctrine-indexed-bundle
More information about tourze/doctrine-indexed-bundle
Files in tourze/doctrine-indexed-bundle
Package doctrine-indexed-bundle
Short Description A Symfony bundle that enhances Doctrine ORM with automatic index management using PHP 8 attributes
License MIT
Informations about the package doctrine-indexed-bundle
Doctrine Indexed Bundle
中文
A Symfony bundle that enhances Doctrine ORM with automatic index management.
Features
- Automatically adds indexes to specified entity properties
- Supports regular, fulltext, and unique indexes
- Smart index naming strategy, automatically handles long table names
- Attribute-based configuration (PHP 8 attributes), no extra config files
- Zero configuration required, works out-of-the-box
Requirements
- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine Bundle 2.13 or higher
Installation
Usage
-
Register the bundle in
config/bundles.php: - Use attributes to mark entity fields that require indexes:
Configuration
This bundle requires no configuration and works out-of-the-box. However,
you can customize index names by providing a name parameter to the attributes:
Index Naming Convention
The bundle automatically generates index names as follows:
- Regular index:
{table_name}_idx_{column_name} - Fulltext index:
{table_name}_fulltext_{column_name} - Unique constraint:
{table_name}_unique_{column_name}
If the generated name exceeds the maximum length (64 characters), the bundle will use MD5 hashing to create a shorter name while maintaining uniqueness.
Advanced Usage
Custom Index Names
You can specify custom names for indexes:
Multiple Attributes
You can combine different index types on the same entity:
How It Works
- Listens to Doctrine's
loadClassMetadataevent and scans entity properties - Checks for
IndexColumn,FulltextColumn, orUniqueColumnattributes on properties - Automatically adds the corresponding index to the entity field
- Naming strategy ensures compatibility with DBMS index name length limits
Contributing
Feel free to submit issues and pull requests to help improve this bundle.
License
MIT License
All versions of doctrine-indexed-bundle with dependencies
doctrine/orm Version ^3.0
symfony/config Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/http-kernel Version ^7.3
symfony/property-access Version ^7.3
tourze/bundle-dependency Version 1.*
tourze/symfony-dependency-service-loader Version 1.0.*
yiisoft/strings Version ^2.1