furic/redeem-codes
Composer 安装命令:
composer require furic/redeem-codes
包简介
The redeem code system used for creating redeem codes to compensate users, or giving rewards in events.
README 文档
README
Retired. This package is no longer maintained. The successor is
furic/filament-redeem-codes— a ground-up rewrite as a Filament v5 plugin with multi-reward campaigns, admin-managed reward types, a typed API, and a real test suite. New projects should use that instead.
A plug-and-play redeem code management system for Laravel applications.
laravel-redeem-codes is a lightweight package for managing and redeeming codes in Laravel projects. Originally developed for player compensation and event reward systems at Sweaty Chair Studio, this package offers both a clean API and a simple web-based console for managing redeem codes.
If you're looking for more flexible implementations, also consider:
Table of Contents
Installation
Install the package via Composer:
composer require furic/redeem-codes
Laravel 5.5+ will auto-discover the service provider. For earlier versions, register it manually.
Manual Setup (for Laravel < 5.5)
Add the service provider to your config/app.php:
'providers' => [ // ... Furic\RedeemCodes\RedeemCodesServiceProvider::class, ],
Configuration
Publish the package's configuration and migration files:
php artisan vendor:publish
Then run the migration to create the redeem codes table:
php artisan migrate
Usage
Web Console
Visit your application at /redeem-codes to access the web-based admin console.
Use this interface to browse, create, and manage redeem codes visually.
Redeem Code Parameters
When creating a redeem code, the following fields are available:
- Code Prefix: Optional prefix for the redeem code(s), useful for organizing events (e.g.,
EASTER23_). All codes are 12 characters in total. - Reusable: If enabled, the same code can be used by multiple users. Note: the package does not enforce per-user usage restrictions—you must handle this on the client side.
- Count: Number of codes to generate.
- Description: Internal notes about the purpose of the code batch.
- Rewards: Define one or more reward types with a quantity. Rewards are stored as numeric types and should be interpreted using an Enum or similar mapping on the client side.
To modify reward types or customize the form, edit the
index.blade.phpfile.
Redeem Validator API
The API endpoint:
GET /api/redeem/{code}
This will return the reward data in JSON format for valid codes (HTTP 200) or an error response (HTTP 400) if invalid, already used, or expired.
Explore the API in the Postman documentation.
Unity Client Integration
If you're using Unity, you can connect easily using this open source client: 👉 Unity-Redeem-Codes Repo
TODO
- ✅ Add configurable reward item types via config file.
- 🔒 Add authentication for web console (currently open).
- 🧪 Add tests and model factories.
- 📜 Add history log page (already logged in DB).
- ⚠ Add server-side check for reusable codes (low priority).
License
This package is open-sourced software licensed under the MIT license.
furic/redeem-codes 适用场景与选型建议
furic/redeem-codes 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 56 次下载、GitHub Stars 达 10, 最近一次更新时间为 2020 年 11 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「event」 「laravel」 「reward」 「promo code」 「coupon code」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 furic/redeem-codes 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 furic/redeem-codes 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 furic/redeem-codes 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Symfony bundle for broadway/broadway.
This is an Event Emitter equivalent to Node.js' Event Emitter.
Publish / Subscribe / Event Manager
A PHP library to implement the observer pattern
Alfabank REST API integration
Extend Interfaces for PSR 14 EventDispatcher
统计信息
- 总下载量: 56
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-01