How najibulmiddya/hotelsbooking works
Project Type and Purpose
• This is a full-stack web application (“Hotel Booking Portal”) built on PHP using the CodeIgniter 3 MVC framework.
• It serves two user roles:
• Guests (browse rooms, book, pay via Razorpay, view/download receipts)
• Admins (manage rooms, bookings, users, reports, refunds, notifications)
File Structure
• Top-level “index.php” is the CI front controller.
• “system/” folder: CodeIgniter core.
• “application/” folder: your app code, organized as MVC.
• application/controllers/Users & Admin
• application/models/…_model.php
• application/views/… (User views, admin views, error pages)
• application/config/ (routes, database, email, memcached, hooks)
• application/third_party/dompdf (PDF lib)
• “assets/”: static CSS/JS/images for frontend & admin UI
• “hotels (1).sql”: MySQL schema dump
README Insights
• Tech stack: HTML/CSS/Bootstrap/jQuery; PHP/CI3; MySQL; Razorpay API (cURL); DOMPDF; optional memcached caching.
• Features call out PDF generation, email/SMS notifications, admin dashboard metrics.
a) Main Components
• Client Browser (User & Admin UIs)
• Web Server (Apache/nginx + PHP‐FPM)
• CodeIgniter Application
– Front Controller (index.php)
– Router → Controllers (Users, Admin, Razorpay callback)
– Models (UserModel, BookingModel, RoomModel, etc.)
– Views & Templates
• MySQL Database
• Caching Layer (Memcached, optional)
• External Services
– Razorpay Payment Gateway
– SMTP/Email Service
• Third-Party Library
– DOMPDF for PDF generation
b) Relationships & Data Flows
1. Browser sends HTTP(S) requests → Web Server
2. Web Server invokes CI front controller
3. CI Router dispatches to appropriate controller
4. Controller uses Models to read/write MySQL (via DB driver)
5. Controller calls DOMPDF library to render receipts/reports
6. For payments: Controller issues cURL to Razorpay API → receives callback/webhook → updates DB
7. Controller sends email via CI Email library (SMTP)
8. Cacheable data (e.g., room lists) stored/retrieved from Memcached
9. App writes logs to application/logs
c) Architectural Patterns & Principles
• MVC separation: Controllers orchestrate, Models encapsulate data access, Views handle presentation
• Single Entry Point via front controller
• Dependency injection via CI “libraries” and “helpers”
• Layered design: Presentation → Business Logic → Data Access
• Externalizing configuration (application/config/*.php)
d) Key Technologies & Frameworks
• CodeIgniter 3 core (system/)
• MySQL via CI DB Query Builder
• Memcached session/cache drivers
• Razorpay API (cURL in application/controllers/Razorpay.php)
• DOMPDF (application/third_party/dompdf)
• CI Email library for notifications
• Bootstrap/jQuery for UI