How hjagar/tpofinalpwd works
Project Type and Purpose
• This is a full-stack web application: an online shopping cart with both a public storefront and an admin back-office.
• It’s built on a custom PHP MVC framework (under the framework/ folder) and uses MySQL for persistence.
High-Level Architectural Components
a. Clients and Entry Point
• Browser Clients (Customers & Admins)
• HTTP Server (Apache/Nginx + PHP-FPM)
• Front Controller (serve.php / src/public/index.php)
b. Framework Core
• HTTP Kernel & Router (framework/Http/Kernel.php, Router.php)
• Middleware Pipeline (Auth, CSRF, Session under framework/Http/Middleware/)
• Configuration Loader (Environment, ApplicationBuilder in framework/Configuration/)
c. Application Logic
• Controllers (src/Controllers/*Controller.php)
• Business Services (src/Bussiness/Cart.php, Product.php)
• Models & Data Layer (framework/Data/ + src/Models/*.php)
• Query Builder, Database Connection (framework/Data/Database.php)
d. View & Asset Management
• View Engine (framework/View/Compiler.php, View.php) with layouts & partials (src/Views/)
• Asset Manager (framework/Assets/) serves JS/CSS from src/public/css
e. External Services
• MySQL Database (schemas in src/sql/)
• SMTP Mailer via PHPMailer wrapper (framework/Mail/EmailSender.php)
Core Data Flows & Interactions
• HTTP Request → Front Controller → Kernel → Middleware Chain → Router → Controller
• Controller invokes Business Service → Data Layer queries/updates MySQL
• Controller produces either:
– HTML View (via View Engine + injected assets)
– JSON Response for AJAX (via JsonResponse/JsonResult)
• Response travels back up middleware → Kernel → HTTP Response to Client
• Mail-related actions call EmailSender (SMTP) asynchronously
Architectural Patterns & Principles
• MVC (Model-View-Controller) separation
• Layered Architecture: Presentation → Application → Domain → Infrastructure
• Middleware Pipeline for cross-cutting concerns
• Dependency Injection & Bootstrapping via ApplicationBuilder
• Single Front Controller entry point