How wassim-rached/project-php-2023 works
Project type and purpose
• This is a small full-stack PHP web application (“Mini Projet 2023 – Gestion des Stages”) for managing internships (stages) with CRUD pages for students, teachers, defenses (“soutenances”) and an admin authentication layer.
• It uses PHP (with PDO), MySQL, Nginx (with a Docker Compose setup), plus static CSS/JS for the UI.
File structure
• Top-level:
• docker-compose.yml → defines services (web, db).
• nginx-conf/default.conf → Nginx virtual-host config.
• sql/create.sql & insert.sql → DB schema & seed.
• css/, js/ → static assets.
• src/ → PHP code, subdivided into:
– authentication (login.php, logout.php)
– enseignant, etudiant, soutenance modules (CRUD pages)
– utils (dbconfig, connexion, adminOnlyPage)
– index.php → landing/auth form.
• README.md documents the schema, pages, and flow.
README for additional insights
• Confirms a MySQL “stages” database with four tables (Etudiant, Enseignant, Soutenance, Administrateur).
• Describes each page’s responsibility and the use of sessions for admin auth.
Main components and their interactions
a. Components:
• User / Browser (interacts over HTTP).
• Nginx web server (reverse–proxy to PHP-FPM).
• PHP application (monolithic code in src/):
• Auth module
• Student, Teacher, Defense modules
• Utils (DB connection, access control)
• MySQL database (containerized).
• Static asset server (served by Nginx).
b. Relationships / Data flows:
1. User submits HTTP request → Nginx
2. Nginx routes to PHP-FPM → appropriate PHP script in src/
3. PHP script uses PDO (via dbconfig & connexion) to query/update MySQL
4. PHP renders HTML embedding CSS/JS assets back to the browser
5. User can navigate, triggering CRUD operations or login/logout
c. Architectural patterns / principles:
• Monolithic PHP code organized by functional modules.
• Single database backing all modules.
• Session-based admin authentication.
• Separation of concerns:
• src/authentication, src/etudiant, src/enseignant, src/soutenance
• Shared utilities in src/utils
d. Key technologies:
• Nginx, Docker Compose
• PHP-FPM, PDO
• MySQL
• HTML5/CSS3/vanilla JavaScript