No description
Find a file
2026-01-11 11:04:00 +01:00
config feat : refacto 2026-01-01 11:48:50 +01:00
src add specific readonly attribut 2026-01-11 11:02:37 +01:00
tests/Marbobley/EntitiesVisitorBundle/Tests/Unit test : add missing case 2026-01-02 11:21:41 +01:00
.gitignore init bundle project 2025-12-30 12:28:33 +01:00
composer.json fix : add missing package 2026-01-01 19:29:29 +01:00
composer.lock fix : add missing package 2026-01-01 19:29:29 +01:00
README.md feat : update readme file 2026-01-01 20:29:37 +01:00

entities-visitor-bundle

Package to manage visitors with DB persistence in Symfony

Installation

composer require marbobley/entities-visitor-bundle

Usage

Create an entity Visitor and extends it from VisitorInformation

  • Create the migration script: symfony console make:migration
  • Migrate the script : symfony console doctrine:migrations:migrate

When someone visits your site, the event listener will create an entry into the VisitorInformation table

Features

Currently, the bundle only supports Doctrine ORM.

Column saved :

  • client ip
  • user Agent
  • visited at
  • method
  • route
  • control
  • path

Setting :

Create a config file :

  • In config/packages/entities_visitor_bundle.yaml
entities_visitor_bundle:
    enable: false #To activate or desactive the check of visitor 

Example

<?php

namespace App\Entity;

use App\Repository\VisitorInformationRepository;
use Doctrine\ORM\Mapping as ORM;
use Marbobley\EntitiesVisitorBundle\Model\VisitorInformation as VisitorInformationModel;

#[ORM\Entity(repositoryClass: VisitorInformationRepository::class)]
class VisitorInformation extends VisitorInformationModel
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    public function getId(): ?int
    {
        return $this->id;
    }
}