Download the PHP package tourze/coupon-command-bundle without Composer
On this page you can find all versions of the php package tourze/coupon-command-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tourze/coupon-command-bundle
More information about tourze/coupon-command-bundle
Files in tourze/coupon-command-bundle
Package coupon-command-bundle
Short Description 口令优惠券系统,提供基于口令的优惠券发放、验证和使用记录功能
License MIT
Informations about the package coupon-command-bundle
CouponCommandBundle
中文
A Symfony bundle for coupon command code system that provides command-based coupon distribution and management functionality.
Table of Contents
- Features
- Requirements
- Installation
- Quick Start
- Core Concepts
- JsonRPC Interface
- Admin Interface
- Architecture
- Usage Examples
- Advanced Usage
- Service Configuration
- Error Handling
- Testing
- Contributing
- Support
- License
- Changelog
Features
- Command Management: Create, edit, and delete coupon command codes
- Usage Restrictions: Multi-dimensional usage restrictions (time, count, user groups, etc.)
- JsonRPC Interface: Standard JSON-RPC 2.0 API endpoints
- Admin Interface: Complete management interface based on EasyAdmin
- Usage Records: Complete command usage tracking and statistics
- Flexible Restrictions: Time windows, usage limits, and user targeting
- User Group Targeting: Allow specific users or user tags to use commands
Requirements
- PHP 8.1+
- Symfony 6.4+
- Doctrine ORM 3.0+
- tourze/coupon-core-bundle
- tourze/json-rpc-core
Installation
Install via Composer
Enable the Bundle
Add to config/bundles.php:
Database Migration
Quick Start
Core Concepts
Restriction Types
- Time Restrictions: Set valid time range for commands
- Count Restrictions: Total usage count and per-user usage limits
- User Restrictions: Specify allowed user groups for command usage
- Status Control: Enable/disable command restrictions
JsonRPC Interface
Validate Command - ValidateCouponCommand
Validates command validity without actually using the command.
Request Parameters:
Response Example:
Use Command - UseCouponCommand
Use command to claim coupon.
Request Parameters:
Response Example:
Admin Interface
The bundle provides complete EasyAdmin management interface:
-
Command Configuration Management -
CommandConfigCrudController- Create and edit commands
- Link to coupons
- View usage statistics
-
Restriction Configuration Management -
CommandLimitCrudController- Set usage restrictions
- Configure time windows
- Manage user group restrictions
- Usage Record Viewing -
CommandUsageRecordCrudController- View detailed usage records
- Success/failure statistics
- User usage tracking
Architecture
Entity Relationships
- CommandConfig: Command configuration, linked to specific coupons
- CommandLimit: Command usage restriction configuration
- CommandUsageRecord: Command usage tracking records
Service Layer
- CommandValidationService: Command validation and execution
- CommandManagementService: Command management and statistics
Core Features
- Audit Trails: All usage is tracked with IP, user, and timestamp information
- Flexible Validation: Time-based, count-based, and user-based restrictions
- Admin Interface: Complete CRUD operations via EasyAdmin controllers
Usage Examples
Basic Usage
Advanced Usage
User Group Restrictions
Service Configuration
In services.yaml, the bundle automatically registers the following services:
CommandValidationService: Command validation serviceCommandManagementService: Command management service- JsonRPC methods:
ValidateCouponCommand,UseCouponCommand
Error Handling
Common Error Messages
| Error Message | Description | Solution |
|---|---|---|
| Command does not exist | Entered command is not configured | Check if command is correct or has been created |
| Coupon does not exist | Associated coupon has been deleted | Re-associate with a valid coupon |
| Command usage time is outside valid period | Outside time restrictions | Check time configuration |
| Command usage count has reached limit | Exceeded total count limit | Increase limit or create new command |
| You are not in the usage scope of this command | User not in allowed list | Add user to allowed list |
| You have reached the usage limit for this command | User personal count limit exceeded | Increase personal usage limit |
Logging
All command usage is logged with detailed information:
- Usage timestamp
- User information
- Success/failure status
- Failure reason
- Additional context information
Testing
Run the test suite:
Test coverage includes:
- Entity unit tests
- Service layer business logic tests
- Integration tests
- JsonRPC interface tests
Contributing
Please see CONTRIBUTING.md for details on how to contribute to this project.
Support
For issues or suggestions, please submit an Issue or Pull Request on the main repository.
License
MIT License
Changelog
v0.0.1
- Initial version release
- Complete command system functionality
- JSON-RPC 2.0 interface support
- EasyAdmin management interface
- Complete unit test coverage
All versions of coupon-command-bundle with dependencies
ext-date Version *
ext-json Version *
doctrine/collections Version ^2.3
doctrine/dbal Version ^4.0
doctrine/doctrine-bundle Version ^2.13
doctrine/orm Version ^3.0
doctrine/persistence Version ^4.1
easycorp/easyadmin-bundle Version ^4
knplabs/knp-menu Version ^3.7
psr/container Version ^1.1|^2.0
symfony/config Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/framework-bundle Version ^7.3
symfony/http-kernel Version ^7.3
symfony/property-access Version ^7.3
symfony/routing Version ^7.3
symfony/security-core Version ^7.3
symfony/serializer Version ^7.3
symfony/service-contracts Version ^3.6
symfony/yaml Version ^7.3
tourze/arrayable Version 1.*
tourze/bundle-dependency Version 1.*
tourze/coupon-core-bundle Version 0.1.*
tourze/doctrine-indexed-bundle Version 1.0.*
tourze/doctrine-ip-bundle Version 1.1.*
tourze/doctrine-snowflake-bundle Version 1.1.*
tourze/doctrine-timestamp-bundle Version 1.1.*
tourze/doctrine-user-bundle Version 1.0.*
tourze/easy-admin-extra-bundle Version 1.0.*
tourze/easy-admin-menu-bundle Version 1.0.*
tourze/json-rpc-core Version 1.0.*