Download the PHP package tourze/doctrine-random-bundle without Composer
On this page you can find all versions of the php package tourze/doctrine-random-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package doctrine-random-bundle
Doctrine Random Bundle
中文
A Symfony bundle that provides automatic random string generation for Doctrine entity properties using PHP attributes.
Features
- Generate random string values for entity properties
- Configurable prefix and string length
- Automatic value generation on entity creation (Doctrine prePersist event)
- Skips generation if property already has a value
- Simple integration with Symfony auto-configuration
Requirements
- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine Bundle 2.13 or higher
- Doctrine ORM 2.20/3.0 or higher
Installation
This bundle is auto-registered by Symfony Flex. No extra configuration is required.
Quick Start
Add the RandomStringColumn
attribute to your entity property:
When you persist a new entity, the randomId
property will be automatically filled if it is empty:
Configuration
The RandomStringColumn
attribute accepts the following parameters:
prefix
: String prefix for the random value (default: '')length
: Length of the random string (default: 16)
Advanced Details
- The bundle uses a Doctrine event listener (
RandomStringListener
) to automatically generate random strings for properties marked with theRandomStringColumn
attribute during theprePersist
event. - If the property already has a value, it will not be overwritten.
- The random string is composed of numbers and upper/lowercase letters.
Contribution Guide
Contributions are welcome! To contribute:
- Open an issue for bug reports or feature requests.
- Submit a pull request with clear description and relevant tests.
- Follow PSR coding standards.
- Run tests with PHPUnit before submitting.
License
This bundle is released under the MIT License. See the LICENSE file for details.
Changelog
- v0.1.0: Initial release with random string attribute and event listener support.
Author
Maintained by tourze.
Configuration
The RandomStringColumn
attribute accepts the following parameters:
prefix
: String prefix for the random value (default: '')length
: Length of the random string (default: 16)
Example
License
This bundle is available under the MIT license. See the LICENSE file for more information.
All versions of doctrine-random-bundle with dependencies
doctrine/dbal Version ^4.0
doctrine/doctrine-bundle Version ^2.13
doctrine/orm Version ^3.0
doctrine/persistence Version ^3.1 || ^4
psr/log Version ^3|^2|^1
symfony/cache-contracts Version ^3
symfony/config Version ^6.4
symfony/dependency-injection Version ^6.4
symfony/doctrine-bridge Version ^6.4
symfony/framework-bundle Version ^6.4
symfony/http-kernel Version ^6.4
symfony/lock Version ^6.4
symfony/property-access Version ^6.4
symfony/yaml Version ^6.4 || ^7.1
tourze/bundle-dependency Version 0.0.*
tourze/doctrine-entity-checker-bundle Version ~0.0.8
tourze/symfony-integration-test-kernel Version 0.0.*