`lthn/php-commerce` — A Laravel package providing orders, subscriptions, invoices, and payment processing. This is a **package** (not a standalone app), tested with Orchestra Testbench.
The package has two PSR-4 roots, serving different purposes:
-`Core\Mod\Commerce\` (root `./`) — The module: models, services, events, Livewire components, routes. `Boot.php` extends `ServiceProvider` with event-driven lazy-loading via `$listens`.
-`Core\Service\Commerce\` (root `./Service/`) — The service definition layer: implements `ServiceDefinition` for the platform's service registry (admin menus, entitlements, versioning).
Livewire components are registered inside `onAdminPanel()` and `onWebRoutes()`, not auto-discovered. All components use the `commerce.admin.*` or `commerce.web.*` naming prefix.
The system supports a three-tier entity model configured in `config.php` under `matrix` and `entities`:
- **M1 (Master Company)** — Owns the product catalogue, source of truth
- **M2 (Facade/Storefront)** — Selects from M1 catalogue, can override content
- **M3 (Dropshipper)** — Full catalogue inheritance, no management responsibility
`PermissionMatrixService` controls cross-entity access. It has a "training mode" (prompts for undefined permissions) and "strict mode" (undefined = denied).
-`View/Modal/Admin/` — Admin panel (managers for orders, coupons, products, etc.)
### Scheduled Commands
`Console/` has artisan commands registered in `onConsole()`: dunning processing, renewal reminders, exchange rate refresh, usage sync to Stripe, referral commission maturation, expired order cleanup, and tree planting for subscribers.