tourze/doctrine-hostname-bundle

0.0.2 2025-04-25 08:48 UTC

This package is auto-updated.

Last update: 2025-04-27 09:52:12 UTC


README

English | 中文

Latest Version Build Status Quality Score Total Downloads

A Symfony bundle for automatically recording the hostname when creating or updating Doctrine entities.

Features

  • Automatically records hostname on entity creation
  • Automatically records hostname on entity update
  • Configuration via PHP 8.1 attributes
  • Integrates with Doctrine Entity Checker Bundle

Requirements

  • PHP 8.1 or higher
  • Symfony 6.4 or higher
  • Doctrine Bundle 2.13 or higher

Installation

composer require tourze/doctrine-hostname-bundle

Quick Start

Add the attributes to your entity properties:

use Tourze\DoctrineHostnameBundle\Attribute\CreatedInHostColumn;
use Tourze\DoctrineHostnameBundle\Attribute\UpdatedInHostColumn;

class YourEntity
{
    #[CreatedInHostColumn]
    private ?string $createdInHost = null;

    #[UpdatedInHostColumn]
    private ?string $updatedInHost = null;
}

The bundle will automatically:

  • Set createdInHost to the current hostname when the entity is created
  • Set updatedInHost to the current hostname when the entity is updated

Documentation

  • Simple configuration via PHP attributes
  • Customizable column names for hostname fields
  • Fully compatible with other Tourze Doctrine extensions

Contributing

Feel free to submit issues and PRs. Please follow PSR code standards and provide relevant tests.

License

MIT License © Tourze

Changelog

See [CHANGELOG.md] for details (if available).