Add configuration for cron key and document code style conventions

- 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.
This commit is contained in:
2026-02-27 14:57:02 +01:00
parent 66263440bb
commit 0d31931295
9 changed files with 181 additions and 1 deletions

View File

@@ -0,0 +1,65 @@
# 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/`.