Download the PHP package tourze/doctrine-user-bundle without Composer
On this page you can find all versions of the php package tourze/doctrine-user-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tourze/doctrine-user-bundle
More information about tourze/doctrine-user-bundle
Files in tourze/doctrine-user-bundle
Package doctrine-user-bundle
Short Description A Symfony Bundle for automatically tracking entity creators and updaters
License MIT
Informations about the package doctrine-user-bundle
Doctrine User Bundle
中文
A Symfony Bundle for automatically tracking entity creators and updaters.
Features
- Automatically track entity creators and updaters
- Simple integration using PHP 8 Attributes
- Works with Symfony Security component
- No database schema modifications required
- Compatible with Symfony 7.3+ applications
- Zero configuration required
Installation
Install this package via Composer:
Requirements
- PHP 8.1+
- Symfony 7.3+
- Doctrine ORM
Usage
Basic Usage
In your entity classes, use the CreateUserColumn and UpdateUserColumn attributes to mark user fields:
When an entity is created or updated, the marked fields will automatically be set to the currently logged-in user.
Alternative Attributes
The bundle also provides additional attributes for more specific use cases:
CreatedByColumn: Records only the essential information about the creatorUpdatedByColumn: Records only the essential information about the updater
Configuration
In your Symfony project, ensure the bundle is registered in the config/bundles.php file:
The bundle will be automatically configured with sensible defaults.
Advanced Usage
Custom Property Accessor
If you need to customize how properties are accessed, you can override the property accessor service:
Logging Configuration
The bundle uses Monolog for logging. You can configure the logger channel:
Entity Checker Integration
This bundle integrates with the doctrine-entity-checker-bundle to provide additional validation capabilities.
How It Works
This bundle leverages Doctrine's event system to automatically set the user fields when entities are persisted or
updated. The UserListener class subscribes to Doctrine's prePersist and preUpdate events and sets the appropriate
user fields based on the current security context.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
All versions of doctrine-user-bundle with dependencies
doctrine/orm Version ^3.0
doctrine/persistence Version ^4.1
monolog/monolog Version ^3.1
psr/log Version ^3|^2|^1
symfony/config Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/framework-bundle Version ^7.3
symfony/http-kernel Version ^7.3
symfony/property-access Version ^7.3
symfony/security-bundle Version ^7.3
symfony/security-core Version ^7.3
symfony/yaml Version ^7.3
tourze/bundle-dependency Version 1.*
tourze/doctrine-entity-checker-bundle Version 1.0.*
tourze/doctrine-helper Version 1.0.*
tourze/symfony-dependency-service-loader Version 1.*