A RESTful Task Manager API built in pure PHP — no frameworks, no CMS. Demonstrates clean PHP OOP, PDO database access, and REST API design from scratch.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/tasks |
List all tasks |
| GET | /api/tasks/{id} |
Get single task |
| POST | /api/tasks |
Create task |
| PUT | /api/tasks/{id} |
Update task |
| DELETE | /api/tasks/{id} |
Delete task |
# Create a task
curl -X POST https://your-site/api/tasks \
-H "Content-Type: application/json" \
-d '{
"title": "Set up CI/CD pipeline",
"description": "Configure GitHub Actions",
"priority": "high",
"status": "pending"
}'
# List all tasks
curl https://your-site/api/tasks{
"id": 1,
"title": "Task title",
"description": "Task description",
"status": "pending | in_progress | completed",
"priority": "low | medium | high",
"created_at": "2026-05-11 10:35:10",
"updated_at": "2026-05-11 10:35:10"
}git clone https://github.com/sonalijohn/php-task-api.git
cd php-task-api
ddev start
ddev mysql -e "CREATE TABLE IF NOT EXISTS 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
);"Visit: https://php-task-api.ddev.site/api/tasks
- PHP 8.2 · MySQL · PDO · DDEV · Apache
Sonali John — Drupal & PHP Full Stack Developer LinkedIn · GitHub