reyhan-commerce / core
Next-Gen Headless E-Commerce Core Framework for Laravel 13
Requires
- php: ^8.4
- alareqi/filament-tree: ^1.0
- bezhansalleh/filament-shield: ^4.3
- bokshorn-it/filament-activity-timeline: ^1.4
- dedoc/scramble: ^0.13.45
- filament/filament: ^5.8
- filament/spatie-laravel-media-library-plugin: ^5.8
- filament/spatie-laravel-settings-plugin: ^5.8
- laravel/framework: ^13.17
- laravel/horizon: ^5.49
- laravel/octane: ^2.19
- laravel/pennant: ^1.26
- laravel/pulse: ^1.8
- laravel/reverb: ^1.12
- laravel/sanctum: ^4.3
- marcusvbda/filament-realtime-driver: ^0.1.2
- morilog/jalali: ^3.4
- rankbeam/laravel-seo-filament: ^1.12
- shuvroroy/filament-spatie-laravel-backup: ^4.0
- shuvroroy/filament-spatie-laravel-health: ^3.3
- spatie/laravel-data: ^4.23
- spatie/laravel-medialibrary: ^11.0
- spatie/laravel-permission: ^8.3
- spatie/laravel-settings: ^3.9
- spatie/laravel-sluggable: ^4.0
- zvizvi/filament-column-filters: ^0.0.6
- zvizvi/filament-notifications-tabs: ^0.0.3
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
🌿 Reyhan Commerce Core (reyhan-commerce/core)
Sovereign Enterprise Headless E-Commerce Engine for Laravel 13
Engineered for High Concurrency, Double-Entry Financial Precision, and Modular Extensibility
📖 Overview
reyhan-commerce/core is the sovereign, engine-level framework library powering the Reyhan Commerce ecosystem. It provides the domain models, database migrations, commercial calculation pipelines, double-entry financial ledger, and high-concurrency reservation mechanics required to run modern, mission-critical e-commerce platforms.
Designed from first principles according to Farshid's Laravel Constitution:
- 100% Strict Typing: Zero implicit type coercion (
declare(strict_types=1);mandatory across all classes). - Single-Responsibility Actions: Business logic is encapsulated into
finalAction classes withexecute(). - Zero Repositories: Native, optimized Eloquent queries and relationships without leaky abstraction layers.
- Dynamic Extensibility: Models and pipelines are swappable at runtime without altering core source code.
- Two-Tier Concurrency Guard: In-memory Redis reservations backed by PostgreSQL pessimistic row locking (
lockForUpdate).
⚡ Installation & Quick Start
1. Require Core via Composer
Install the core package into any existing Laravel 13 application:
composer require reyhan-commerce/core
(Alternatively, scaffold a complete turnkey store application using composer create-project reyhan-commerce/reyhan my-store or the reyhan-commerce/installer CLI tool).
2. Publish Configuration & Run Migrations
# Publish core configuration file php artisan vendor:publish --tag=reyhan-config # Execute core database migrations php artisan migrate # Optional: Run Reyhan system doctor check php artisan reyhan:doctor
3. Register Filament Admin Plugin (Optional)
If using Filament for administration, register the ReyhanCorePlugin in your panel provider:
use Reyhan\Core\ReyhanCorePlugin; public function panel(Panel $panel): Panel { return $panel ->default() ->id('admin') ->plugin(ReyhanCorePlugin::make()); }
🏛️ Domain Architecture & First-Class Facades
Reyhan Core provides clean, expressive facades for all core business domains:
| Facade | Service Class | Primary Responsibility |
|---|---|---|
Reyhan\Core\Facades\Reyhan |
Reyhan\Core\Support\Reyhan |
Model binding registry, versioning, runtime resolutions |
Reyhan\Core\Facades\Cart |
Reyhan\Core\Services\Cart\CartService |
Multi-channel cart lifecycle, persistence, items |
Reyhan\Core\Facades\Pricing |
Reyhan\Core\Services\Pricing\PricingService |
Multi-tier price computation, discounts, taxes |
Reyhan\Core\Facades\Inventory |
Reyhan\Core\Services\Inventory\StockReservationService |
Two-tier Redis & PostgreSQL stock locks |
Reyhan\Core\Facades\Checkout |
Reyhan\Core\Services\Checkout\CheckoutService |
Order creation pipelines, invoice snapshots |
Reyhan\Core\Facades\Ledger |
Reyhan\Core\Services\Accounting\LedgerService |
Double-entry accounting ledger & balance audits |
🧩 Dynamic Model Extensibility
Need to extend or replace the core Product or Order model with your own custom Eloquent model? Use Reyhan::useModel() in your application's AppServiceProvider:
namespace App\Providers; use Illuminate\Support\ServiceProvider; use Reyhan\Core\Facades\Reyhan; use App\Models\CustomProduct; use App\Models\CustomOrder; final class AppServiceProvider extends ServiceProvider { public function boot(): void { // Replace default models at runtime Reyhan::useModel('product', CustomProduct::class); Reyhan::useModel('order', CustomOrder::class); } }
Every relationship, calculation pipeline, and query inside Reyhan Core will automatically resolve and instantiate your extended model classes.
🛡️ Two-Tier Concurrency Protection
To guarantee zero overselling during high-traffic flash sales:
- Tier 1 (Redis Fast Locks): Atomic Redis decrements with 15-minute expiration window during initial checkout reservation.
- Tier 2 (PostgreSQL Pessimistic Lock): Database transaction using
ProductVariant::where('id', $id)->lockForUpdate()upon final payment settlement.
📚 Ecosystem Repositories
| Repository | Purpose | Packagist / Link |
|---|---|---|
reyhan-commerce/core |
Framework Core Library | reyhan-commerce/core |
reyhan-commerce/reyhan |
Starter Application Skeleton | reyhan-commerce/reyhan |
reyhan-commerce/installer |
Composer Global CLI Scaffolder | reyhan-commerce/installer |
reyhan-commerce/storefront-nuxt |
Nuxt 4 Commercial Storefront | GitHub Repository |
reyhan-commerce/docs |
Official VitePress Docs Site | Live Documentation |
🤝 Contributing
Please see CONTRIBUTING.md and ARCHITECTURE.md for details on code architecture, static analysis requirements, and pull request guidelines.
📄 License
The Reyhan Commerce Core framework is open-sourced software licensed under the MIT license.