- Added cron key to config.php for scheduled tasks. - Created code_style_and_conventions.md to outline PHP version, file naming, DI pattern, controller wiring, Medoo ORM pitfalls, test conventions, caching, and database structure. - Added project_overview.md detailing the purpose, tech stack, architecture, entry points, and key classes of the shopPRO project. - Introduced suggested_commands.md for testing and system utilities commands. - Added task_completion_checklist.md for a structured approach to completing tasks. - Included .DS_Store files in autoload and templates directories for macOS compatibility.
2.5 KiB
2.5 KiB
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 (
$mdbglobal, 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
matchexpressions (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
- Domain (
autoload/Domain/) — Business logic repositories, 27 modules - Admin (
autoload/admin/) — Admin panel controllers, support, validation, view models - Frontend (
autoload/front/) — Customer-facing controllers and views - API (
autoload/api/) — REST API controllers - 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— Frontendadmin/index.php— Admin panelapi.php— REST APIajax.php— Frontend AJAXadmin/ajax.php— Admin AJAXcron.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:
autoload/{namespace}/class.{ClassName}.php(legacy)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/.