PHPackages                             valksor/php-doctrine-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. valksor/php-doctrine-tools

ActiveLibrary[Database &amp; ORM](/categories/database)

valksor/php-doctrine-tools
==========================

Database utilities and enhanced tools for Doctrine ORM including migrations, console commands, and performance optimizations

00PHPCI passing

Since Dec 28Pushed 3mo agoCompare

[ Source](https://github.com/valksor/php-doctrine-tools)[ Packagist](https://packagist.org/packages/valksor/php-doctrine-tools)[ RSS](/packages/valksor-php-doctrine-tools/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Valksor Component: DoctrineTools
================================

[](#valksor-component-doctrinetools)

[![valksor](https://camo.githubusercontent.com/2af5a6a7e5f7da47cd0a924c8b00038f208f45f9b0d5be8d7a497a9808168187/68747470733a2f2f62616467656e2e6e65742f7374617469632f6f72672f76616c6b736f722f677265656e)](https://github.com/valksor)[![BSD-3-Clause](https://camo.githubusercontent.com/72547f8afb6b5ace804caebbf95c3bcbfc027ce9214777bc452f308f3165db01/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4253442d2d332d2d436c617573652d677265656e3f7374796c653d666c6174)](https://github.com/valksor/php-doctrine-tools/blob/master/LICENSE)[![Coverage Status](https://camo.githubusercontent.com/2ae22281daa4964085432bf89cc97d14cc4e6e9f35ac80fa8c4746686a5de7f5/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f76616c6b736f722f7068702d646f637472696e652d746f6f6c732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/valksor/php-doctrine-tools?branch=master)[![php](https://camo.githubusercontent.com/77da2f7bbc049873edb2d1045a756d7a32e3ba50440a8e0e76a9109f62f0771b/68747470733a2f2f62616467656e2e6e65742f7374617469632f7068702f2533453d382e342f707572706c65)](https://www.php.net/releases/8.4/en.php)

A comprehensive collection of Doctrine tools, traits, and utilities that enhance database operations, provide custom DQL functions, UTC datetime handling, and entity management capabilities for Symfony applications using Doctrine ORM and DBAL.

Features
--------

[](#features)

- **Custom Entity Traits**: Reusable traits for common entity patterns (UUID, ULID, timestamps, versioning, etc.)
- **UTC DateTime Types**: Custom Doctrine types for consistent UTC datetime handling
- **Custom DQL Functions**: Extended DQL functions for PostgreSQL-specific features
- **Database Extensions**: Automatic registration of PostgreSQL extensions (unaccent, pgcrypto)
- **Migration Tools**: Enhanced migration utilities and version comparison
- **Entity Management**: Simplified entity creation and lifecycle management
- **Event Subscribers**: Doctrine event listeners for schema and migration management

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require valksor/php-doctrine-tools
```

Requirements
------------

[](#requirements)

- PHP 8.4 or higher
- Doctrine DBAL 4.0 or higher
- Doctrine ORM
- Doctrine Migrations
- Symfony Framework
- Valksor Bundle (for automatic configuration)

Usage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

1. Register the bundle in your Symfony application:

```
// config/bundles.php
return [
    // ...
    Valksor\Bundle\ValksorBundle::class => ['all' => true],
    // ...
];
```

2. Enable the DoctrineTools component:

```
# config/packages/valksor.yaml
valksor:
    doctrine_tools:
        enabled: true
```

The component will automatically configure Doctrine with all available types, functions, and extensions.

### Entity Traits

[](#entity-traits)

#### Complete Entity

[](#complete-entity)

Use the `_Entity` trait for a complete entity setup with common fields:

```
