No description
  • PHP 37.6%
  • JavaScript 23.6%
  • CSS 19.7%
  • HTML 17.4%
  • Bru 1%
  • Other 0.7%
Find a file
2026-02-13 08:12:56 +01:00
.github Feat/home (#7) 2026-02-11 19:43:04 +01:00
bruno Feat/home (#7) 2026-02-11 19:43:04 +01:00
css feat: add booking modal (#14) 2026-02-13 08:12:56 +01:00
img Fix/auth (#4) 2026-02-12 15:53:40 +01:00
js feat: add booking modal (#14) 2026-02-13 08:12:56 +01:00
php fix: unable to book trip (#13) 2026-02-12 16:14:51 +01:00
views fix: unable to book trip (#13) 2026-02-12 16:14:51 +01:00
.dockerignore feat(assets): Add assets for project 2026-02-03 08:43:52 +01:00
.editorconfig first commit 2026-01-12 16:12:57 +01:00
.gitattributes first commit 2026-01-12 16:12:57 +01:00
.gitignore Feat/backend (#1) 2026-01-27 11:23:48 +01:00
.htaccess Feat/backend (#1) 2026-01-27 11:23:48 +01:00
404.html first commit 2026-01-12 16:12:57 +01:00
apache-config.conf Feat/backend (#1) 2026-01-27 11:23:48 +01:00
composer.json Feat/backend (#1) 2026-01-27 11:23:48 +01:00
composer.lock Feat/backend (#1) 2026-01-27 11:23:48 +01:00
Dockerfile fix(docker): update container restart policy and initialize SQLite DB 2026-01-27 13:49:27 +01:00
favicon.ico first commit 2026-01-12 16:12:57 +01:00
icon.png first commit 2026-01-12 16:12:57 +01:00
icon.svg first commit 2026-01-12 16:12:57 +01:00
index.html Fix/auth (#4) 2026-02-12 15:53:40 +01:00
index.php Fix/auth (#4) 2026-02-12 15:53:40 +01:00
MIGRATIONS_README.md Feat/search (#5) 2026-02-03 17:22:01 +01:00
README.MD Feat/home (#7) 2026-02-11 19:43:04 +01:00
robots.txt first commit 2026-01-12 16:12:57 +01:00
site.webmanifest first commit 2026-01-12 16:12:57 +01:00
start_server.sh Feat/backend (#1) 2026-01-27 11:23:48 +01:00

BlablISEN - Plateforme de Covoiturage Sécurisée en PHP Natif

PHP SQLite

Ce projet est une application de covoiturage simple implémentée avec un backend PHP (sans framework) et un frontend HTML/CSS/JS Vanilla.

Architecture

  • Backend : PHP 8.x
    • Structure MVC maison
    • Routeur dans index.php qui gère /api/* et sert les fichiers statiques HTML pour les autres routes.
    • Base de données SQLite (fichier db/blablISEN.db)
    • Sécurité : CSRF, XSS headers, sanitization des entrées, password hashing.
    • Communication JSON pour toutes les routes /api.
  • Frontend : HTML5, CSS3, Javascript (Fetch API)
    • Single Page Application (SPA-like) feeling mais avec des fichiers HTML distincts chargés par le routeur PHP.
    • Interactions asynchrones avec l'API backend.

Installation et Démarrage

  1. Assurez-vous d'avoir PHP installé.
  2. Installez composer https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos
  3. Lancez l'installation des dépendances :
    composer install
    
  4. Lancez le serveur de développement :
    ./start_server.sh
    
    Ou manuellement :
    php -S localhost:8080 index.php
    
  5. Accédez à l'application sur http://localhost:8080

Note : La base de données est initialisée automatiquement si elle n'existe pas lors de la première requête, ou via /api/init-db.

Endpoints API

Toutes les réponses de l'API sont au format JSON.

Authentification

  • GET /api/csrf : Récupère un token CSRF valide.
  • POST /api/login : Connecte un utilisateur.
    • Body: { "email": "...", "password": "...", "csrf_token": "..." }
  • POST /api/register : Inscrit un nouvel utilisateur.
    • Body: { "email": "...", "password": "...", "firstname": "...", "lastname": "...", "phone": "...", "csrf_token": "..." }
  • GET /api/logout : Déconnecte l'utilisateur.

Utilisateur

  • GET /api/user/profile : Récupère les infos du profil, les véhicules et les réservations de l'utilisateur connecté.

Trajets (Trips)

  • GET /api/trips?from=...&to=...&date=... : Recherche des trajets.
  • POST /api/trips/create : Publie un nouveau trajet.
    • Body: { "departure_city": "...", "arrival_city": "...", "departure_time": "...", "seats_available": 3, csrf_token": "..." }

Réservations (Bookings)

  • POST /api/book : Réserve un trajet.
    • Body: { "trip_id": 1, "seats": 1, "csrf_token": "..." }

Notes (Ratings)

  • POST /api/ratings/add : Note un conducteur après un trajet.
    • Body: { "trip_id": 1, "driver_id": 2, "rating": 5, "comment": "...", "csrf_token": "..." }

Tests API avec Bruno

Le dossier bruno/ contient la collection complète pour tester l'API.

  1. Ouvrez Bruno.
  2. Ouvrez la collection située dans le dossier bruno/ du projet.
  3. Sélectionnez l'environnement Local.
  4. L'ordre recommandé pour tester est :
    1. Auth / 01 - Get CSRF Token (Indispensable pour récupérer le token initial)
    2. Auth / Register Action
    3. Auth / 02 - Login Action
    4. Trips / Create Trip
    5. Trips / List Trips
    6. Bookings / Book Trip