Download the PHP package tourze/lottery-bundle without Composer
On this page you can find all versions of the php package tourze/lottery-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package lottery-bundle
Lottery Bundle
中文
A comprehensive lottery system bundle for Symfony applications featuring multiple lottery types, advanced prize pool management, chance control, and automated prize distribution.
Table of Contents
- Features
- Installation
- Requirements
- Install via Composer
- Quick Start
- Bundle Registration
- Database Setup
- Configuration
- Console Commands
- JSON-RPC API
- System Architecture
- Event System
- Advanced Usage
- Custom Event Subscribers
- Expression Language
- External Integration
- Contributing
- License
Features
- Multiple Lottery Types - Support for wheel, grid, slot machine, and on-site lotteries
- Advanced Prize Pool Management - Multi-pool system with configurable probabilities and constraints
- Intelligent Chance Management - User chances with expiration tracking and status control
- Automated Prize Distribution - Automatic prize sending with consignee management
- Admin Interface - Complete EasyAdmin integration for lottery management
- Responsive H5 Frontend - Mobile-optimized lottery interface with multiple themes
- Event-Driven Architecture - Customizable event system for business logic extension
- JSON-RPC API - RESTful API endpoints for external system integration
- Cron Job Integration - Automated background tasks for maintenance and processing
- Expression Language - Flexible configuration with dynamic rule evaluation
- Concurrent Safety - Database-level locking for high-concurrency scenarios
Installation
Requirements
- PHP 8.1 or higher
- Symfony 7.3 or higher
- Doctrine ORM 3.0 or higher
- MySQL 5.7+ or PostgreSQL 10+
- Redis (recommended for caching)
Install via Composer
Quick Start
Bundle Registration
Add to config/bundles.php:
Database Setup
Configuration
The bundle provides flexible configuration through:
- Activity Settings - Configure lottery activities with time constraints and participation rules
- Prize Pool Management - Set up multiple pools with different probability algorithms
- Prize Configuration - Define virtual rewards, physical prizes, and distribution methods
- Chance Control - Monitor user participation limits and success tracking
Console Commands
lottery:check-expire-chance
Checks and processes expired lottery chances. This command runs every minute via cron job.
Purpose: Automatically marks expired chances as invalid and triggers expire events for cleanup.
lottery:check-review-chance-send-prize
Processes reviewed chances and sends prizes to winners. This command runs every hour at 43 minutes.
Purpose: Automatically sends prizes to users whose chances have been reviewed and approved.
JSON-RPC API
The bundle exposes JSON-RPC procedures for external integrations:
Lottery Operations
JoinLottery- Execute lottery participation with concurrent safetyGetAllLotteryChance- Retrieve comprehensive lottery chance dataGetLotteryDetail- Get detailed activity information and rulesServerSendLotteryChance- Administrative chance distribution
User Management
GetUserLotteryChanceList- User's participation history with paginationGetUserValidLotteryChanceCounts- Real-time valid chance countsGetLotteryConsignee- User delivery address informationSaveOrUpdateLotteryConsignee- Manage shipping addresses
Prize Information
GetLotteryPrizeList- Available prizes with stock information
System Architecture
The lottery system implements a robust workflow with concurrent safety:
- Activity Validation - Verify lottery timing, status, and participation eligibility
- Chance Authentication - Validate user's available chances with database locking
- Chance Pre-deduction - Atomically reserve chances to prevent overselling
- Pool Selection - Dynamic pool determination based on configurable rules
- Prize Algorithm - Probability-based prize selection with stock management
- Result Confirmation - Transactional commit with event dispatching
- Prize Distribution - Automated or manual prize fulfillment process
Event System
Extensive event system for business logic customization:
Core Events
UserJoinSuccessEvent- Dispatched after successful lottery participationAfterChanceExpireEvent- Triggered when user chances expireChanceEvent- General chance lifecycle event
Customization Events
DecidePoolEvent- Override default pool selection algorithmDecidePrizeProbabilityEvent- Implement custom probability calculationsAllLotteryChanceEvent- Global event for all chance operations
Advanced Usage
Custom Event Subscribers
Extend lottery functionality with event subscribers:
Expression Language
Implement complex business rules with expression language:
External Integration
Integrate with external systems via JSON-RPC:
Contributing
Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.
All versions of lottery-bundle with dependencies
ext-mbstring Version *
cloned/luckybox Version ^0.9
doctrine/collections Version ^2.3
doctrine/common Version ^3.5
doctrine/data-fixtures Version ^2.0
doctrine/dbal Version ^4.0
doctrine/doctrine-bundle Version ^2.13
doctrine/doctrine-fixtures-bundle Version ^4.0
doctrine/orm Version ^3.0
doctrine/persistence Version ^3.1 || ^4
easycorp/easyadmin-bundle Version ^4
fakerphp/faker Version ^1.23
knplabs/knp-menu Version ^3.7
nesbot/carbon Version ^2.72 || ^3
psr/log Version ^3|^2|^1
symfony/config Version ^6.4
symfony/console Version ^6.4
symfony/dependency-injection Version ^6.4
symfony/doctrine-bridge Version ^6.4
symfony/event-dispatcher Version ^6.4
symfony/event-dispatcher-contracts Version ^2.5 | ^3
symfony/expression-language Version ^6.4
symfony/framework-bundle Version ^6.4
symfony/http-foundation Version ^6.4
symfony/http-kernel Version ^6.4
symfony/messenger Version ^6.4
symfony/routing Version ^6.4
symfony/security-bundle Version ^6.4
symfony/security-core Version ^6.4
symfony/security-http Version ^6.4
symfony/serializer Version ^6.4
symfony/yaml Version ^6.4 || ^7.1
tourze/arrayable Version 0.0.*
tourze/async-contracts Version 0.0.*
tourze/backtrace-helper Version 0.1.*
tourze/benifit-bundle Version 0.0.*
tourze/bundle-dependency Version 0.0.*
tourze/doctrine-helper Version 0.0.*
tourze/doctrine-indexed-bundle Version 0.0.*
tourze/doctrine-ip-bundle Version 0.0.*
tourze/doctrine-precision-bundle Version 0.1.*
tourze/doctrine-snowflake-bundle Version 0.1.*
tourze/doctrine-timestamp-bundle Version 0.0.*
tourze/doctrine-track-bundle Version 0.1.*
tourze/doctrine-user-bundle Version 0.0.*
tourze/easy-admin-menu-bundle Version 0.1.*
tourze/enum-extra Version 0.1.*
tourze/json-rpc-cache-bundle Version 0.1.*
tourze/json-rpc-core Version 0.0.*
tourze/json-rpc-http-endpoint-bundle Version 0.1.*
tourze/json-rpc-lock-bundle Version 0.1.*
tourze/json-rpc-log-bundle Version 0.1.*
tourze/lock-service-bundle Version 0.1.*
tourze/resource-manage-bundle Version 0.1.*
tourze/symfony-cron-job-bundle Version 0.1.*
tourze/symfony-ecol-bundle Version 0.1.*
tourze/symfony-routing-auto-loader-bundle Version 0.0.*
tourze/text-manage-bundle Version 0.0.*
tourze/user-event-bundle Version 0.0.*
tourze/user-id-bundle Version 0.1.*