Batch 12 | Module 7 Assignment
A complete task management application built with pure PHP OOP, Tailwind CSS, and Alpine.js. Demonstrates CRUD operations, database abstraction, MVC-style architecture, and modern frontend design.
- Project Overview
- Features
- Tech Stack
- Directory Structure
- Setup Instructions
- Assignment Tasks
- OOP Concepts Used
- Database Schema
- Routing
- Screenshots
- Author
This project fulfills the Module 7 assignment requirements which covered:
- Task 1: String & Array Manipulation (
task1.php) - Task 2: Encapsulation — Employee Management (
task2.php) - Task 3: Inheritance — Vehicle System (
task3.php)
Beyond the assignment, a full-featured CRUD web application was built inside the app/ directory to demonstrate real-world application of all OOP concepts.
- Create, Read, Update, and Delete tasks
- Task properties: title, description, status, priority
- Search tasks by title or description
- Dashboard with stat cards (Pending, In Progress, Completed)
- Flash messages for user feedback
- Responsive design — works on mobile and desktop
- Auto-creation of database and tables on first run
- Input sanitization and SQL injection prevention
| Layer | Technology |
|---|---|
| Backend | PHP 7.4+ (OOP, PDO, MVC-style) |
| Database | MySQL (auto-created via PDO) |
| Styling | Tailwind CSS (CDN) |
| Interactivity | Alpine.js 3.x (CDN) |
| Server | Apache / PHP built-in server |
class/
├── task1.php # String & Array Manipulation
├── task2.php # Employee Encapsulation
├── task3.php # Vehicle Inheritance
├── app/ # Full CRUD Application
│ ├── config/
│ │ └── Database.php # Singleton PDO connection
│ ├── models/
│ │ └── Task.php # Task model with full CRUD
│ ├── controllers/
│ │ └── TaskController.php # Request handler & router logic
│ ├── views/
│ │ ├── layout.php # Base HTML template
│ │ ├── index.php # Task list + stats + search
│ │ ├── create.php # Create task form
│ │ ├── edit.php # Edit task form
│ │ └── show.php # Single task detail view
│ └── public/
│ ├── index.php # Front controller (entry point)
│ └── .htaccess # Apache URL rewriting
└── README.md # This file
- PHP 7.4 or higher
- MySQL 5.7 or higher
- Apache (XAMPP / WAMP / MAMP) — or PHP built-in server
- Start Apache and MySQL from your control panel
- Copy the
classfolder to your web root:- XAMPP:
C:\xampp\htdocs\class - WAMP:
C:\wamp64\www\class
- XAMPP:
- Open browser and visit:
- Assignment files:
http://localhost/class/task1.php - CRUD app:
http://localhost/class/app/public/
- Assignment files:
- The database
crud_appandtaskstable are created automatically
# Navigate to the project directory
cd c:\Users\GSMOSTAD\Desktop\ostad\class
# Start the server
php -S localhost:8000
# Then visit:
# Assignment: http://localhost:8000/task1.php
# CRUD app: http://localhost:8000/app/public/Note: Make sure MySQL is running before starting the server. Database credentials can be changed in
app/config/Database.php.
File: task1.php
Processes a list of email strings — trims whitespace, converts names to Title Case, and extracts domain names.
Input: [" rAHim@gmail.com ", " kArim@outlook.com ", " sUmi@yahoo.com "]
Output: Name: Rahim, Domain: gmail.com
Name: Karim, Domain: outlook.com
Name: Sumi, Domain: yahoo.comFile: task2.php
An Employee class with private properties, constructor initialization, and salary management through controlled methods.
$employee = new Employee("Alice", 5000);
$employee->updateSalary(1000);
$employee->getDetails(); // Name: Alice, Salary: 6000File: task3.php
Demonstrates inheritance with a base Vehicle class and a child Car class using parent::__construct() and method extension.
$myCar = new Car("Toyota", "Corolla");
$myCar->displayDetails(); // This is a Toyota Corolla.| Concept | Where |
|---|---|
| Encapsulation | Task model (private $db, $table), Employee class (private $name, $salary) |
| Inheritance | Car extends Vehicle, layout views extend layout.php pattern |
| Singleton Pattern | Database class — single PDO instance shared across the app |
| Constructor | Used in Database, Task, TaskController, Employee, Vehicle, Car |
| Prepared Statements | All database queries use PDO bindings |
| Separation of Concerns | MVC-style: Model / Controller / Views |
The tasks table is created automatically on first connection:
CREATE TABLE tasks (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT,
status ENUM('pending', 'in_progress', 'completed') DEFAULT 'pending',
priority ENUM('low', 'medium', 'high') DEFAULT 'medium',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;To change database credentials, edit app/config/Database.php:
$host = '127.0.0.1';
$dbname = 'crud_app';
$user = 'root';
$pass = '';All requests go through app/public/index.php (front controller):
| URL | Action | Method |
|---|---|---|
/app/public/ |
List all tasks | GET |
/app/public/?action=create |
Show create form | GET |
/app/public/?action=store |
Save new task | POST |
/app/public/?action=show&id=1 |
View single task | GET |
/app/public/?action=edit&id=1 |
Show edit form | GET |
/app/public/?action=update&id=1 |
Save updated task | POST |
/app/public/?action=delete&id=1 |
Delete a task | POST |
/app/public/?action=search&q=keyword |
Search tasks | GET |
Shows all tasks in a responsive table with status/priority badges, stats cards, and a search bar.
Full view of a single task with description, timestamps, and edit/delete actions.
Clean form with title, description, status dropdown, and priority selector.
Built for Ostad — Batch 12, Module 7 Students- Shamim Hossain.