🎵 Smart Room Booking System

QR Geofencing & Gamification

Version 2.0.0 — Documentation

📖 Table of Contents

  1. Overview
  2. Server Requirements
  3. Quick Install (Recommended)
  4. Manual Installation
  5. Configuration
  6. Feature Flags
  7. Admin Panel Usage
  8. User Guide
  9. Push Notifications Setup
  10. Cron Jobs
  11. Complete Feature List
  12. Troubleshooting
  13. Production Checklist
  14. Support

1. Overview

Smart Room Booking System is a complete, self-hosted room reservation platform built for music schools, rehearsal studios, co-working spaces, and any venue that needs smart room management.

Built with PHP 8.0+ and MySQL — no framework dependencies. The system includes a Progressive Web App (PWA) with push notifications, a full gamification engine with token economy, and a unique QR code check-in system with GPS geofencing to prevent no-shows.

Homepage — room cards with live availability
Homepage — browse rooms grouped by building with live availability indicators

Tech Stack

LayerTechnology
BackendPHP 8.0+ (vanilla, no framework)
DatabaseMySQL 5.7+ / MariaDB 10.6+
FrontendHTML5, CSS3, Vanilla JS
UI LibrariesjQuery, jQuery UI, Bootstrap 4, GSAP, Font Awesome
Charts & MapsChart.js, Leaflet.js
EmailPHPMailer (bundled)
Pushminishlink/web-push ^10.0 (via Composer)

2. Server Requirements

RequirementMinimum VersionNotes
PHP8.0+Required
MySQL / MariaDB5.7+ / 10.6+Required
Web ServerApache or NginxApache with mod_rewrite recommended
PHP Extensionsmysqli, mbstring, json, session, openssl, curl, fileinfo
Composer2.xRequired — auto-run by installer
SSL Certificate—Optional — required for push notifications & PWA install

3. Quick Install (Recommended)

The easiest way to get started. No command line needed.

1
Upload Files Extract the ZIP and place all project files in your web server's document root (e.g., /var/www/html/booking/ or C:\xampp\htdocs\booking\).
2
Open the Installer Visit http://your-domain/install.php in your browser.
3
Step 1 — Requirements Check The installer automatically verifies PHP version, required extensions, and directory permissions. Fix any issues shown in red before proceeding.
Installer Step 1 — Requirements Check
Installer Step 1 — automated requirements and environment check
4
Step 2 — Database Setup Enter your database host, port, username, password, and database name. The installer creates the database automatically if it doesn't exist and imports all 18 tables from the schema.
Installer Step 2 — Database Configuration
Installer Step 2 — enter database credentials; the schema is imported automatically
5
Step 3 — App Configuration Set the application name and choose which feature modules to enable:
  • Gamification & Tokens — Badges, streaks, ranks, leaderboard, token economy, reward shop
  • QR Code Check-In — QR scanning and GPS geofencing system
Installer Step 3 — App Configuration
Installer Step 3 — set app name and toggle feature modules
6
Step 4 — Create Admin Account Create the first administrator account with name, email, username, and password.
Installer Step 4 — Admin Account Creation
Installer Step 4 — create the first administrator account
7
Step 5 — Finalize The installer generates the .env configuration file, runs composer install, and creates a lock file to prevent re-installation. Delete install.php when prompted.
Installer Step 5 — Finalize
Installer Step 5 — environment file generated, dependencies installed
✅ Done! Visit your site and log in with the admin account you just created.
Installation Complete
Installation complete — ready to log in

4. Manual Installation

If you prefer command-line setup:

Step 1 — Extract Files

# Apache / XAMPP / WAMP example
C:\xampp\htdocs\booking\

# Linux example
/var/www/html/booking/

Step 2 — Install Dependencies

cd /path/to/booking
composer install

This installs minishlink/web-push and vlucas/phpdotenv into the vendor/ directory.

Step 3 — Configure Environment

cp .env.example .env

Edit .env with your settings:

DB_HOST=localhost
DB_PORT=3306
DB_USERNAME=your_db_user
DB_PASSWORD=your_db_password
DB_DATABASE=hall_booking

APP_NAME="Hall Booking"
APP_DEBUG=false

FEATURE_TOKENS=true
FEATURE_GAMIFICATION=true
FEATURE_QR_CHECKIN=false
⚠️ Security: Never share or commit the .env file. It contains your database credentials.

Step 4 — Create Database

Option A — Command Line

mysql -u root -p -e "CREATE DATABASE hall_booking CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -p hall_booking < schema.sql

Option B — phpMyAdmin

  1. Create a new database (e.g., hall_booking) with utf8mb4_unicode_ci collation
  2. Go to the Import tab
  3. Upload schema.sql and click Go

Step 5 — Set File Permissions (Linux/macOS)

chmod -R 755 /path/to/booking/
chmod -R 775 /path/to/booking/images/
chmod -R 775 /path/to/booking/sessions/

Step 6 — Create Admin Account

  1. Register a normal account via the registration page
  2. Promote it to admin in the database:
UPDATE users SET isAdmin = 1 WHERE username = 'your_username';

Step 7 — Verify

Visit http://your-domain/ — you should see the login page:

Login Page
Login page — supports remember-me and password reset

5. Configuration

All configuration is managed through the .env file. A template is provided in .env.example.

VariableDescriptionDefault
DB_HOSTDatabase hostlocalhost
DB_PORTDatabase port3306
DB_USERNAMEDatabase username—
DB_PASSWORDDatabase password—
DB_DATABASEDatabase name—
APP_NAMEApplication display nameHall Booking
APP_DEBUGShow detailed errorsfalse
FEATURE_TOKENSEnable token economy & reward shoptrue
FEATURE_GAMIFICATIONEnable badges, streaks, ranks, leaderboardtrue
FEATURE_QR_CHECKINEnable QR check-in & GPS geofencingfalse

6. Feature Flags

Three major features can be independently toggled via the .env file:

Token Economy

Set FEATURE_TOKENS=false to disable:

Gamification

Set FEATURE_GAMIFICATION=false to disable:

ℹ️ Note: Gamification depends on the token system. Setting FEATURE_TOKENS=false automatically disables gamification regardless of its own flag.

QR Code Check-In

Set FEATURE_QR_CHECKIN=false to disable:

ℹ️ Note: QR check-in can also be toggled at runtime from the admin panel — no restart or file editing needed.

7. Admin Panel Usage

Access the admin panel at /admin/admin_panel.php (requires an admin account).

Dashboard

The admin dashboard shows 20+ real-time metrics including: users online, bookings today/this week, hours logged, rooms occupied, peak hours, system health (DB size, PHP version, uptime), recent bookings, and recent logins.

Admin Dashboard
Admin dashboard — 20+ real-time metrics at a glance

Room & Building Management

Buildings: Create buildings with name, address, GPS coordinates, and geofence radius. Use the interactive Leaflet.js map to set coordinates by clicking, searching, or entering manually.

Building Management
Building management — list of all buildings with address and geofence settings
Building Geolocation Map
Interactive Leaflet.js map — set GPS coordinates and geofence radius per building

Rooms: Create rooms within buildings. Set name, upload an image (drag-and-drop), add amenity tags (20+ predefined + custom), set min/max booking durations, and toggle maintenance mode.

Room Management List
Room management — overview of all rooms
Room Edit Form
Room editor — image upload, amenity tags, duration limits
Room QR Code
Printable QR code per room — download as PNG for door signage

User Management

User Management
User management — search, filter, change levels, suspend, or promote

Booking Levels

Configure 3 user levels from the admin panel:

SettingDescriptionRange
Level NameDisplay name (e.g., "Student", "Teacher", "VIP")Up to 30 characters
Days in AdvanceHow far ahead this level can book1–365 days
Max Bookings/DayMaximum daily reservations0–50 (0 = unlimited)
Booking Levels Configuration
Booking levels — configure advance days and daily limits per tier

Announcements

Create announcements with 3 types (Info, Warning, Celebration), optional priority, and expiration date. Announcements are delivered via in-app notification, push notification, and email broadcast simultaneously.

Announcements
Announcement system — multi-channel delivery (in-app, push, email)

Badge & Reward Management

Create, edit, toggle, and delete custom badges and shop rewards with full control over pricing, quantities, and duration.

Badge Management
Badge management — create and toggle achievement badges
Reward Management
Reward management — set prices, quantities, and durations

Token Economy

Monitor token circulation, adjust earning rates, and manage the overall economy from the admin panel.

Token Economy Settings
Token economy — configure earning rates and monitor circulation

Email Configuration

Configure SMTP settings entirely from the admin panel: host, port, encryption (TLS/SSL/none), username, password, sender name, and sender email. Use the Test Email button to verify your configuration.

SMTP Email Settings
SMTP configuration — host, port, encryption, credentials, and test button

Reports & Logs

5 report types with custom date ranges:

Booking logs support filtering, pagination, and CSV/PDF export.

Booking Logs
Booking logs — filterable list with CSV/PDF export

8. User Guide

Browsing Rooms

The homepage displays all rooms organized by building. Each room card shows the room photo, amenity icons, and current availability status.

Room Listing
Room listing — browse all rooms with amenity tags and availability

Booking a Room

  1. Click a room card to view its detail page (image, amenities, heatmap, availability)
  2. Select a date and time using the visual time-slot picker or dropdown selectors
  3. Click Book — the system checks for conflicts in real-time
  4. Confirm the booking details
  5. View your bookings under My Bookings
Room Booking — Select Time
Select date and time slot for your booking
Room Booking — Confirm
Confirm booking details before submission
Booking Confirmed
Booking confirmed — success notification with booking details
My Bookings
My Bookings — upcoming and past reservations with quick actions

Quick Book Widget

Use the quick-book widget on the homepage to instantly find and book available rooms for a specific date and time range.

Quick Book Widget
Quick Book — find available rooms instantly by date and time

QR Check-In (when enabled)

  1. A QR code is printed/posted on each room's door
  2. Open the app (PWA) and go to Check-In or use the scan button
  3. Scan the room's QR code with your device's camera
  4. The system verifies your GPS location against the building's geofence
  5. If within range, you're checked in. If not, you see your exact distance
  6. To leave early, scan the QR code again — remaining time is freed instantly
QR Check-In Settings
QR check-in admin settings — toggle, geofence radius, check-in window, and auto-release

Reward Shop & Gamification

Reward Shop
Reward Shop — spend tokens on exclusive rewards
How to Earn Tokens
How to Earn — see all token-earning activities

Themes & Languages

Users can switch between 5 themes and 15 languages including RTL Arabic support. Preferences are saved automatically.

Theme Selector
Theme selector — 5 visual themes
Language Selector
Language selector — 15 languages with RTL support

Weather Widget

The homepage includes an optional weather widget showing current conditions for your venue's location.

Weather Widget
Weather widget — current conditions on the homepage
Weather Widget Settings
Admin weather settings — configure location and display options

Profile

9. Push Notifications Setup

⚠️ Requirement: Push notifications require your site to be served over HTTPS.
  1. Log in as admin
  2. Go to Admin Panel → Push Notification Settings
  3. Click Generate VAPID Keys — keys are stored in the database
  4. Push is now active. Users can subscribe from their profile page
  5. Use Send Test to verify it works

Push notifications are sent for: announcements, booking reminders, admin cancellations, and user shoutouts.

Push Notification Settings
Push notification settings — manage subscriptions and send test notifications
Generate VAPID Keys
Generate VAPID keys — one-click key pair creation
VAPID Keys Generated
VAPID keys generated — ready for push subscriptions

10. Cron Jobs

Two optional cron jobs enhance the experience:

Booking Reminders

# Send email reminders ~1 hour before bookings (run every 15 minutes)
*/15 * * * * php /path/to/booking/cron/booking_reminder.php

Badge Backfill

# Assign badges retroactively for existing users (run once after upgrade)
php /path/to/booking/cron/backfill_badges.php

11. Complete Feature List

Core Booking

QR Check-In & GPS Geofencing

PWA & Push

Gamification & Tokens

Admin Panel

Security

Internationalization

12. Troubleshooting

“Connection failed” error

Blank page / 500 error

Composer errors

Push notifications not working

Upload / image issues

13. Production Checklist

14. Support

If you encounter any issues or have questions, please reach out through the Codester item comments or support system. We aim to respond within 24 hours.

What's Included