A comprehensive web-based hostel management system built with PHP and MySQL, designed to streamline hostel operations for both administrators and students.
- Room Management: Browse available rooms, view room details, and book rooms
- Maintenance Requests: Submit and track maintenance requests for room issues
- Complaint System: File complaints and track their resolution status
- Visitor Management: Register visitors and manage visitor requests
- Billing: View billing information and payment history
- Announcements: Receive and view important hostel announcements
- Profile Management: Update personal information and account settings
- Dashboard: Overview of occupancy rates, recent bookings, and system statistics
- Room Management: Add, edit, and manage room inventory with occupancy tracking
- User Management: Manage student and admin accounts with role-based access
- Maintenance: Review and respond to maintenance requests
- Billing Management: Create invoices, track payments, and send reminders
- Visitor Management: Approve/deny visitor requests and manage visitor logs
- Announcements: Create and manage hostel-wide announcements
- Analytics: Generate reports and view system analytics
- Backend: PHP 8.0+
- Database: MySQL 8.0+
- Frontend: HTML5, CSS3, JavaScript, Bootstrap 5
- Additional Libraries:
- PHPMailer for email functionality
- DOMPDF for PDF generation
- DataTables for enhanced table functionality
- SweetAlert2 for notifications
- Select2 for enhanced dropdowns
- XAMPP (includes Apache and MySQL)
- PHP 8.0 or higher
- MySQL 8.0 or higher
- Composer (for dependency management)
git clone https://github.com/brightamoah/hostel-management.git
cd hostel-managementcomposer install- Install XAMPP from https://www.apachefriends.org/
- Start Apache and MySQL services from XAMPP Control Panel
- Place the project files in your XAMPP's
htdocsdirectory
- Open phpMyAdmin in your browser:
http://localhost/phpmyadmin - Create a new database named
hostel_management - Import the database schema:
- Navigate to the
databasefolder in the project - Import
hostel_management.sqlfile into your database
- Navigate to the
- Update database connection settings in
database/db.php:private $db_host = 'localhost'; private $db_user = 'root'; private $db_name = 'hostel_management'; private $db_password = '';
- Open your browser and navigate to:
http://localhost/hostel-management - Default admin credentials will be created during database setup
├── api/ # API endpoints
│ ├── student/ # Student-specific APIs
│ └── admin/ # Admin-specific APIs
├── app/ # Application logic
│ ├── controllers/ # Controllers
│ ├── models/ # Database models
│ └── admin/ # Admin-specific logic
├── assets/ # Static assets
│ ├── css/ # Stylesheets
│ ├── js/ # JavaScript files
│ └── img/ # Images
├── Components/ # Reusable components
│ ├── admin/ # Admin components
│ ├── auth/ # Authentication components
│ └── home/ # Home page components
├── config/ # Configuration files
├── database/ # Database files
├── pages/ # Application pages
│ ├── admin/ # Admin pages
│ ├── auth/ # Authentication pages
│ ├── home/ # Home pages
│ └── student/ # Student pages
├── services/ # Service classes
├── utils/ # Utility functions
└── vendor/ # Composer dependencies
- Registration: Create a new account with student credentials
- Room Booking: Browse available rooms and book your preferred room
- Maintenance: Submit maintenance requests for any room issues
- Complaints: File complaints about hostel services or facilities
- Visitors: Register visitors in advance for approval
- Billing: View and track your payment history
- Dashboard: Monitor overall hostel statistics and recent activities
- Room Management: Add new rooms, update room details, and track occupancy
- User Management: Manage student accounts and assign roles
- Maintenance: Review and respond to maintenance requests
- Billing: Generate invoices and track payments
- Announcements: Create important announcements for residents
GET /student/rooms-data- Get available roomsPOST /student/room/book/{id}- Book a roomGET /student/maintenance-data- Get maintenance requestsPOST /maintenance/submit- Submit maintenance requestGET /student/visitors-data- Get visitor informationPOST /visitor/register- Register a visitor
GET /admin/rooms-data- Get all roomsPOST /admin/room/add- Add new roomGET /admin/users-data- Get all usersPOST /admin/user/add- Add new userGET /admin/maintenance-data- Get all maintenance requestsPOST /admin/maintenance/update-status- Update maintenance status
- Authentication: Session-based user authentication
- Authorization: Role-based access control (Student/Admin)
- CSRF Protection: Cross-site request forgery protection
- Input Validation: Server-side input validation and sanitization
- Password Security: Secure password hashing
To enable email functionality (for notifications and invoices):
- Update email settings in
services/EmailService.php - Configure SMTP settings for your email provider
- Set up email templates in the appropriate service files
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Create a Pull Request
-
Database Connection Error
- Verify MySQL service is running in XAMPP
- Check database credentials in
database/db.php - Ensure database exists and is properly imported
-
Permission Errors
- Check file permissions in the project directory
- Ensure Apache has read/write access to the project folder
-
Email Not Working
- Configure SMTP settings in
services/EmailService.php - Check email server configuration
- Configure SMTP settings in
-
CSS/JS Not Loading
- Verify the
assetsfolder is accessible - Check file paths in HTML templates
- Verify the
For support and questions, please contact:
- Email: kingshostelmgt@gmail.com
- Phone: +233 54 968 4848