# shopPRO — Project Overview ## Purpose shopPRO is a PHP e-commerce platform with an admin panel, customer-facing storefront, and REST API. ## Tech Stack - **Language**: PHP 7.4 (production runs PHP < 8.0 — do NOT use PHP 8.0+ syntax!) - **ORM**: Medoo (`$mdb` global, injected via DI in new code) - **Caching**: Redis via `\Shared\Cache\CacheHandler` - **Testing**: PHPUnit 9.6 via `phpunit.phar` - **Frontend**: Custom template engine (`\Shared\Tpl\Tpl`) - **Database**: MySQL with `pp_` table prefix - **Platform**: Windows (development), Linux (production) ## PHP 7.4 Constraint — CRITICAL Do NOT use any PHP 8.0+ features: - No `match` expressions (use ternary/if-else) - No named arguments - No union types (`int|string`) - No `str_contains()`, `str_starts_with()`, `str_ends_with()` ## Architecture Domain-Driven Design with Dependency Injection. ### Layers 1. **Domain** (`autoload/Domain/`) — Business logic repositories, 27 modules 2. **Admin** (`autoload/admin/`) — Admin panel controllers, support, validation, view models 3. **Frontend** (`autoload/front/`) — Customer-facing controllers and views 4. **API** (`autoload/api/`) — REST API controllers 5. **Shared** (`autoload/Shared/`) — Cache, Email, Helpers, Html, Image, Tpl ### Domain Modules Article, Attribute, Banner, Basket, Cache, Category, Client, Coupon, Dashboard, Dictionaries, Integrations, Languages, Layouts, Newsletter, Order, Pages, PaymentMethod, Producer, Product, ProductSet, Promotion, Scontainers, Settings, ShopStatus, Transport, Update, User ### Entry Points - `index.php` — Frontend - `admin/index.php` — Admin panel - `api.php` — REST API - `ajax.php` — Frontend AJAX - `admin/ajax.php` — Admin AJAX - `cron.php` — CRON jobs ### Namespace Conventions (case-sensitive on Linux!) - `\Domain\` → `autoload/Domain/` (uppercase D) - `\admin\Controllers\` → `autoload/admin/Controllers/` (lowercase a) - `\Shared\` → `autoload/Shared/` - `\front\` → `autoload/front/` - `\api\` → `autoload/api/` ### Autoloader Custom autoloader (not Composer at runtime). Tries: 1. `autoload/{namespace}/class.{ClassName}.php` (legacy) 2. `autoload/{namespace}/{ClassName}.php` (PSR-4 style) ### Key Classes - `\admin\App` — Admin router - `\front\App` — Frontend router - `\front\LayoutEngine` — Frontend layout engine - `\Shared\Helpers\Helpers` — Utility methods - `\Shared\Tpl\Tpl` — Template engine - `\Shared\Cache\CacheHandler` — Redis cache - `\api\ApiRouter` — REST API router ## Test Suite 765 tests, 2153 assertions. Tests mirror source structure in `tests/Unit/`.