How thetechieakash/booking works
Project type and purpose
• This is a full-stack web application called “Booking” built on PHP using the CodeIgniter 4 MVC framework.
• Purpose: A hotel and trip booking platform with separate admin and user interfaces, backed by a MySQL database, and a rich front-end using Bootstrap and custom JavaScript.
File structure
• Top-level:
• app/ – the CodeIgniter application folder (Controllers, Models, Views, Config, Helpers, Filters, Libraries, Database migrations & seeds).
• public/ – the web-root serving index.php, .htaccess, assets (CSS, JS, images, vendors).
• writable/ – runtime directories (cache, logs, uploads, session).
• spark – CLI tool for migrations and other CodeIgniter utilities.
• tests/ – automated tests (unit, integration, database).
• Patterns:
• MVC layers in app/: Models for data access, Controllers segmented into Admin vs User, Views under app/Views/fronts and app/Views/errors.
• Config folder centralizes environment-specific settings (database, routes, services, security, etc.).
• Database migrations and seeds illustrate schema evolution and initial data loads.
• ThirdParty & Libraries host custom or external PHP code (authentication, hashing).
README for additional insights
• Tech stack: PHP/CodeIgniter 4, MySQL, Bootstrap, JavaScript.
• Deployment: Uses Composer for PHP dependencies, spark CLI for migrations and seeds, .env for environment variables.
• Workflow: Clone, composer install, env setup, migrate, seed, serve with spark.
a. Main components
• Client browsers (desktop/mobile)
• Front-end layer: HTML/CSS/JS (Bootstrap + custom scripts + third-party vendor JS) served from public/assets
• Routing & Entry point: public/index.php → CodeIgniter Router → Controllers
• Controllers:
– User controllers (app/Controllers/User/*)
– Admin controllers (app/Controllers/Admin/*)
• Models (app/Models/*.php) interacting with MySQL via the Database layer/config
• Views (app/Views/fronts & app/Views/errors) generating HTML responses
• Services & Libraries (app/Config, app/Libraries, app/Helpers) for configuration, authentication, caching, encryption
• Filters: AdminFilter, UserFilter enforcing access control
• Database: MySQL instance with tables for users, admins, hotels, rooms, bookings, amenities, photos (migrations define schema)
• Writable storage: logs, cache, sessions, uploads
• CLI spark tool for migrations/seeds
• External dependencies: Composer-managed PHP packages, vendor JS/CSS packs in public/vendors
b. Relationships and data flow
1. User/browser sends HTTP request → web server (Apache/Nginx) → public/index.php
2. CodeIgniter bootstraps (app/Config/Boot) → routing resolves to a Controller
3. Controller may invoke Filters (authentication/authorization)
4. Controller calls Models to read/write database
5. Models use the Database config and drivers to communicate with MySQL
6. Controller loads Views, passing data for rendering HTML
7. Response (HTML + asset references) returns to client
8. Client may then fetch additional AJAX calls to Controllers returning JSON or partial Views
9. spark CLI (offline) interacts with migrations/seeds in app/Database to evolve schema
c. Architectural patterns & principles
• MVC separation: Clear separation of concerns between data (Models), UI (Views), and request handling/business logic (Controllers).
• Modular Controllers by role (Admin vs User)
• Config-driven environment (development/production/testing)
• Dependency injection and service locators via app/Config/Services
• Filter pipeline for cross-cutting concerns (authentication, CORS, CSRF)
• Use of migrations and seeders for reproducible database state
• Public folder isolation for static assets, securing the app/ source code
d. Key technologies/frameworks/libraries
• PHP 8+, CodeIgniter 4 core
• MySQL (via mysqli driver configured in app/Config/Database.php)
• Bootstrap CSS framework, custom CSS/JS under public/assets
• Rich vendor JS ecosystem in public/vendors (mapbox, dropzone, intl-tel-input, echarts, etc.)
• Composer for PHP dependencies, spark CLI for build tasks
Final reminders
• Be granular: split Controllers by admin vs user, show Filters as separate blocks, include migrations & seeds under Database.
• Environment configs (development vs production) as a note on the Config component.