How gregobhm/web_asm works
Project Type and Purpose
• This is a full-stack, MVC-style PHP web application (likely an Attendance Management System given models like Asistencia, Aula, Clase, Estudiante, Nota, etc.).
• It uses Composer, a MySQL (or similar) database, OAuth authentication (Google, Microsoft), email notifications, and plain PHP views & assets.
File Structure
• public/ → Web-accessible entry point (index.php), CSS/JS/IMG
• controllers/ → Request handling & application logic (AuthController, HomeController)
• models/ → Domain entities & database access (Asistencia, Curso, Usuario, etc.)
• views/ → Presentation templates (components/, dashboards/, home, login, register, etc.)
• auth/ → OAuth integration scripts (google.php, microsoft.php, notify.php)
• config/ & config.json → Constants, database connection settings
• utils/ → Helper classes (CorreoConfirmacion, NotificadorCorreo abstraction)
• vendor/ → Third-party libraries (via Composer)
Key Architectural Patterns
• MVC (Model–View–Controller) layered design
• 3-Tier separation: Presentation (views + public), Business Logic (controllers + utils), Data (models + database)
• External integration: OAuth providers & SMTP/email notifier
a. Clients & Browsers
b. Web Server & PHP Runtime
– public/index.php (Front Controller / Router)
– Composer autoloader bringing in controllers, models, utils, vendor libs
c. Application Layer
– Controllers (AuthController, HomeController)
– Utility Services (CorreoConfirmacion, NotificadorCorreo)
d. Data Layer
– Models (Asistencia, Usuario, etc.)
– Database (MySQL with schema from sql/ams.sql)
e. External Services
– OAuth Providers (Google, Microsoft)
– SMTP Mail Server
Relationships & Data Flow
1. User → HTTP Request → public/index.php
2. index.php → Router → Appropriate Controller
3. Controller → calls Models for CRUD → MySQL Database
4. Controller → selects View → sends HTML/JS/CSS back to User
5. Controllers/Utils → send email via SMTP (CorreoConfirmacion)
6. Auth endpoints → redirect to OAuth Providers → callback to auth/google.php or auth/microsoft.php
• “Clients” (Browser, Mobile)
• “Web Tier” (Nginx/Apache + PHP-FPM, public/index.php)
• “App Tier” subdivided into MVC:
– Controllers (AuthController, HomeController)
– Models (Asistencia, Usuario, etc.)
– Utils/Services (Email Notifier)
• “Data Tier” (MySQL Database)
• “External Services” (Google OAuth, Microsoft OAuth, SMTP)
• From Clients to Web Server (HTTP)
• Web Server to Controllers (internal call)
• Controllers to Models (method calls)
• Models to Database (SQL queries)
• Controllers/Utils to SMTP & OAuth (HTTPS requests)
• Responses flow back accordingly
• Blue for “Web & App Tier”
• Orange for “Data Tier”
• Grey for “Utilities & Config”