PHPackages                             tourze/doctrine-hostname-bundle - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tourze/doctrine-hostname-bundle

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tourze/doctrine-hostname-bundle
===============================

记录Hostname

1.0.1(4mo ago)01MITPHPCI passing

Since Mar 25Pushed 4mo ago1 watchersCompare

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

READMEChangelog (5)Dependencies (20)Versions (6)Used By (0)

Doctrine Hostname Bundle
========================

[](#doctrine-hostname-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/690ad55ee3647e6c86322344996bb73e02060f560ceb17daf71a9fab9b603b8f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f646f637472696e652d686f73746e616d652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/doctrine-hostname-bundle)[![PHP Version](https://camo.githubusercontent.com/35a3bdb1bce06d7a3dbf9e85884c3825a7ae0a352825e3e64ecc741b9d690087/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![License](https://camo.githubusercontent.com/c970376ce4a53bd1e5b2cc8db5bb9c03108af378eb0d5db28d91a7385ae770c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f646f637472696e652d686f73746e616d652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/42a41e0bf18f2f740be68a57e700c64bc47ad7577b4665e432b4dc6764401dfc/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f75727a652f646f637472696e652d686f73746e616d652d62756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tourze/doctrine-hostname-bundle)[![Code Coverage](https://camo.githubusercontent.com/b403e080a918f31c01b0ac4260d7f665b9c7bfc11503de3e0a17354957fba73b/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f746f75727a652f646f637472696e652d686f73746e616d652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/tourze/doctrine-hostname-bundle)[![Quality Score](https://camo.githubusercontent.com/7b790fc7103fede99d026cbf931e179931f845c809146012b9893bef96131476/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f646f637472696e652d686f73746e616d652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/doctrine-hostname-bundle)[![Total Downloads](https://camo.githubusercontent.com/d8c355be22794bd219275c69f4feb0f15b5efcf97831b278cc3e72c914c15684/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f646f637472696e652d686f73746e616d652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/doctrine-hostname-bundle)

A Symfony bundle that automatically records the hostname when creating or updating Doctrine entities. This bundle helps track which server handled entity operations in distributed systems.

Features
--------

[](#features)

- **Automatic hostname recording**: Captures server hostname during entity persistence
- **Attribute-based configuration**: Uses PHP 8.1 attributes for clean, declarative setup
- **Separate creation and update tracking**: Different attributes for creation vs update operations
- **Non-intrusive**: Doesn't overwrite existing values if already set
- **Logger integration**: Optional debug logging for troubleshooting
- **High performance**: Minimal overhead with `-99` priority to run after other listeners

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

[](#requirements)

- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine Bundle 2.13 or higher
- Doctrine ORM 3.0 or higher

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

[](#installation)

```
composer require tourze/doctrine-hostname-bundle
```

The bundle will be automatically registered in your Symfony application.

Quick Start
-----------

[](#quick-start)

Add the attributes to your entity properties:

```
