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:
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.
Add the service provider to your config/app.php
:
'providers' => [
// ...
Furic\RedeemCodes\RedeemCodesServiceProvider::class,
],
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
Visit your application at /redeem-codes
to access the web-based admin console.
Use this interface to browse, create, and manage redeem codes visually.
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.php
file.
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.
If you're using Unity, you can connect easily using this open source client: 👉 Unity-Redeem-Codes Repo
- ✅ 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).
This package is open-sourced software licensed under the MIT license.