How krishpatel09/car-rental works
Project Type & Purpose
• Full-stack web application for managing car rentals.
• Two main user roles: Customers (frontend) and Admin (backend).
• Built with PHP on Apache, MySQL database, and static assets (CSS/JS/images).
File Structure & Key Components
A. Presentation Layer
– carrental/index.php, car-listing.php, vehical-details.php, search.php, profile.php, etc. (public customer UI)
– carrental/admin/*.php (admin dashboard & management UI)
– carrental/assets/ (CSS, JS, images, fonts)
– carrental/includes/ (shared header, footer, login, registration, sidebar, config)
B. Application (Business Logic)
– PHP scripts that process form submissions (check_availability.php, post-testimonial.php)
– Admin scripts for CRUD operations on vehicles, bookings, brands, users.
– Shared configuration (includes/config.php) for database connection and global settings.
C. Data Layer
– MySQL database named “carrental” imported from carrental.sql
– Tables: vehicles, brands, bookings, users, testimonials, contacts, subscribers, etc.
D. Infrastructure
– Apache (or Nginx) web server running PHP
– Local environment: XAMPP/WAMP/LAMP stack
– Browser clients for public and admin interfaces
Extract Architectural Patterns
• Layered Architecture:
– Presentation (Views: PHP + HTML + CSS + JS)
– Business Logic (PHP controllers and includes)
– Data Access (SQL queries via PHP’s mysqli or PDO)
• Shared code through PHP includes for headers, footers, config
• No strict MVC framework but logical separation exists.
1. User’s Web Browser (Client)
– Sends HTTP requests for pages or AJAX calls.
2. Web Server (Apache + mod_php)
– Routes requests to appropriate PHP scripts in /carrental or /carrental/admin.
3. PHP Application Layer
– Presentation scripts (index.php, admin/*.php)
– Shared includes for authentication, layout, config
– Business logic modules for booking, user management
4. MySQL Database
– Stores all application data; accessed through config.php credentials
5. Static Asset Server
– Serves CSS/JS/images from /carrental/assets and /carrental/admin/css/js/img
• Browser → Web Server (HTTP GET/POST)
• Web Server → PHP Application → MySQL (queries/responses)
• PHP Application → Static Assets (on page load)
• Admin vs. Public user flows (separate entry points)
Detail Without Over-Splitting
• Logical component (frontend, backend scripts, includes, DB).
• Avoid drawing every single PHP file; instead group them by function (e.g., “Admin CRUD Scripts”).
• External dependencies (PHP, MySQL, Apache).