Introduction
Welcome to the Staff Shift & Leave Management System documentation.
This lightweight, powerful PHP application allows businesses to manage employee shifts, track attendance, and handle leave requests efficiently. Built with pure PHP and MySQL, it offers a fast, secure, and easy-to-use interface for Admins, Managers, and Employees.
System Requirements
- PHP Version: 8.0 or higher
- Database: MySQL 5.7+ or MariaDB 10.2+
- Web Server: Apache (recommended) or Nginx
- Extensions: PDO, OpenSSL, Fileinfo
Installation Guide
1. Upload Files
Extract the zip file and upload the contents to your server's public directory (e.g.,
public_html).
.htaccess file.
These files are often hidden by default on many operating systems but are crucial for security and
directory protection.
2. Database Setup
Create a new MySQL database and import the install/database.sql file via phpMyAdmin or
command line.
3. Configuration
Edit config/database.php and update the credentials:
define('DB_HOST', 'localhost');
define('DB_NAME', 'your_database_name');
define('DB_USER', 'your_db_user');
define('DB_PASS', 'your_db_password');
4. File Permissions
Ensure the following directories are writable (755 or 777 depending on server config):
/assets/uploads//logs//config/(for encryption keys)
Configuration
Email Settings (SMTP)
To enable email notifications, log in as Admin and go to Settings > Email.
Manual Queue Processing
If you don't have a Cron Job set up, or if emails populate the queue but aren't sending, you can force the system to send them:
- Go to Settings > Email page.
- Scroll to the "Email Queue Status" section.
- Click the "Process Queue Now" button.
- The system will attempt to send pending emails immediately.
Cron Job (Optional)
For automatic background email processing (recommended for production), set up a cron job. This ensures that queued emails are sent automatically without manual intervention.
Common Setup (cPanel/Linux)
If you are using cPanel or a Linux server, you can set up a cron job to run every minute or every 5 minutes. Here is a robust example command:
/usr/local/bin/ea-php81 /home/username/public_html/cron/process-emails.php >> /home/username/public_html/logs/email-cron.log 2>&1
/usr/local/bin/ea-php81: The absolute path to the PHP executable (this varies by server; check your hosting docs)./home/username/public_html/cron/process-emails.php: The absolute path to the cron script file.>> /home/username/public_html/logs/email-cron.log: Appends the output to a log file for debugging.2>&1: Redirects errors to the same log file.
Note: Make sure the logs directory exists and is writable if you use
logging.
User Roles & Permissions
| Role | Permissions |
|---|---|
| Admin | Full access to all settings, user management, reports, and system configuration. Can manage all departments. |
| Manager | Can create shifts, approve leaves, and manage employees only within their assigned department. |
| Employee | Can view their own schedule, request leaves, request shift swaps, and view their leave balance. |
Key Features
Shift Management
Admins and Managers can click on any day cell in the calendar to create shifts. Use "Shift Templates" for common shifts (e.g., "9-5 Day Shift") to save time.
Leave Management
Employees request leave -> Managers/Admins approve or reject. The system automatically calculates remaining balances.
Shift Swaps
Employees can request to swap shifts with colleagues. The workflow is: Requester -> Target Peer Acceptance -> Manager Approval.
FAQ
How do I reset the Admin password?
If locked out, check the users table in the database. You can generate a new bcrypt hash or
use the default admin credentials in install/database.sql.
Why are emails not sending?
Check your SMTP settings in the Admin panel. Also, ensure your server allows outbound connections on the SMTP port (usually 587 or 465).
Forgot your password?
If you forgot your password, you can send a reset link to the email address registered in the system.