This repository contains the LAMP stack (Laravel 12) API backend for the multi-platform protocol with multitenancy (W3RD.io, SwampProtocol.io GamerProtocol.io) powering all frontend brands (TokenGames.io, DrewRoberts.com, Web3Journey.org). It serves as the single source of truth for user authentication, real-time updates, and subscription/billing logic and even the game state management.
- Framework: Laravel 12
- Database: MySQL 8.0+ (Utilizing
JSONtype and efficient indexing) - Real-Time: Laravel Reverb (WebSockets)
- Authentication: Laravel Sanctum (API Tokens)
- Billing: Laravel Cashier (Stripe)
- Domain-Driven Architecture: Models, Controllers, and Services are organized into distinct domains (Auth, Game, Billing) for maintainability.
- See
models.mdandservices.mdfor detailed structures.
- See
- Two-Factor Authorization: Every request requires a Sanctum Bearer Token (user authentication) and an X-Client-Key (application authorization) found in the
clientstable. - Real-Time Gameplay: Laravel Reverb pushes instant game state updates to all subscribed clients.
- Flexible Game State: All game boards and hands are stored in the unified
gamestable using the JSON column type (MySQL 8.0+ required) and Laravel casting. Game titles are defined as PHP enums (Connect Four, Checkers, Hearts, Spades), allowing for unlimited game variations without database schema changes. - Matchmaking: Players can be matched in games through Quickplay, Lobbies (public & private) and Rematches.
- Usage Metering: Custom database logic handles complex quotas:
strikes(daily free losses) andquotas(monthly member games).
These packages are essential for implementing the core features and security structures:
| Package | Purpose | Notes |
|---|---|---|
laravel/sanctum |
API Authentication | Handles user login, token generation, and Bearer token validation. |
laravel/cashier |
Subscription Billing | Integrates with Stripe for managing Member/Master subscriptions and webhooks. |
laravel/reverb |
Real-Time Communication | The official first-party WebSocket server for Laravel Broadcasting. |
guzzlehttp/guzzle |
HTTP Client | Needed within your Billing Services to verify mobile app store receipts and interact with external APIs. |
illuminate/database |
Database Features | Ensure support for ULIDs and JSON column casting. |
For full implementation details, refer to the following files in the /docs directory:
- API Endpoints: api.md
- Database Migrations: database.md
- Model Definitions: models.md
- Game Services: services.md
- Admin Panel: admin.md
- Feature Expansion: expansion.md
- Matchmaking: matchmaking.md