tourze / user-event-bundle
用户交互事件
Installs: 26
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.1
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/event-dispatcher-contracts: ^2.5 | ^3
- symfony/framework-bundle: ^6.4
- symfony/http-kernel: ^6.4
- symfony/security-core: ^6.4
- tourze/enum-extra: ~0.0.5
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-04-19 13:14:05 UTC
README
A Symfony bundle for managing user interaction events with flexible and extensible features.
Features
- Automatic collection and management of user interaction events
- Extendable event base class
- Context information support
- Easy integration with existing Symfony applications
Installation
composer require tourze/user-event-bundle
Quick Start
Add the bundle to your config/bundles.php
:
<?php return [ // ... Tourze\UserEventBundle\UserEventBundle::class => ['all' => true], ];
Configure the bundle in config/packages/tourze_user_event.yaml
:
tourze_user_event: use_lookup: true # Optional, defaults to true
Usage
Creating Custom Events
<?php namespace App\Event; use Tourze\UserEventBundle\Event\UserInteractionEvent; class UserMessageEvent extends UserInteractionEvent { public static function getTitle(): string { return 'User Message Event'; } }
Using the Event Finder
<?php namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Tourze\UserEventBundle\Service\EventFinder; class EventController extends AbstractController { #[Route('/events', name: 'app_events')] public function index(EventFinder $eventFinder): Response { $events = $eventFinder->genSelectData(); return $this->render('event/index.html.twig', [ 'events' => $events, ]); } }
Testing
./vendor/bin/phpunit packages/user-event-bundle/tests
License
The MIT License (MIT). Please see License File for more information.