tourze / doctrine-user-agent-bundle
Doctrine + User Agent
Installs: 1 117
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- doctrine/doctrine-bundle: ^2.13
- doctrine/orm: ^2.20 || ^3.0
- doctrine/persistence: ^3.1 || ^4
- psr/log: ^3|^2|^1
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/framework-bundle: ^6.4
- symfony/http-kernel: ^6.4
- symfony/property-access: ^6.4
- symfony/service-contracts: ^3.5
- symfony/yaml: ^6.4 || ^7.1
- tourze/bundle-dependency: 0.0.*
- tourze/doctrine-entity-checker-bundle: ~0.0.8
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-04-25 19:13:12 UTC
README
A Symfony bundle that automatically tracks and records User-Agent information in Doctrine entities.
Features
- Automatically captures User-Agent information from HTTP requests
- Provides attributes to mark entity fields for User-Agent tracking
- Supports tracking User-Agent on both entity creation and updates
- Seamless integration with Doctrine ORM events
- Zero configuration required for basic usage
Installation
composer require tourze/doctrine-user-agent-bundle
Quick Start
- Add the bundle to your application's kernel:
// config/bundles.php return [ // ... Tourze\DoctrineUserAgentBundle\DoctrineUserAgentBundle::class => ['all' => true], ];
- Use the attributes in your entity:
use Tourze\DoctrineUserAgentBundle\Attribute\CreateUserAgentColumn; use Tourze\DoctrineUserAgentBundle\Attribute\UpdateUserAgentColumn; class YourEntity { #[CreateUserAgentColumn] private ?string $createdUserAgent = null; #[UpdateUserAgentColumn] private ?string $updatedUserAgent = null; }
Usage
Available Attributes
#[CreateUserAgentColumn]
: Records User-Agent when the entity is created#[UpdateUserAgentColumn]
: Records User-Agent when the entity is updated
The bundle will automatically capture and store the User-Agent information from the request headers.
Requirements
- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine ORM Bundle 2.13 or higher
Contributing
Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.