tourze / doctrine-user-agent-bundle
Doctrine + User Agent
0.0.1
2025-04-07 02:58 UTC
Requires
- php: ^8.1
- doctrine/doctrine-bundle: ^2.13
- psr/log: ^3|^2|^1
- symfony/framework-bundle: ^6.4
- symfony/property-access: ^6.4
- symfony/yaml: ^6.4 || ^7.1
- tourze/bundle-dependency: 0.0.*
- tourze/doctrine-entity-checker-bundle: 0.0.*
This package is auto-updated.
Last update: 2025-04-07 03:00:18 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.