Halo teman-teman! π Ini adalah aplikasi Todo List yang dibuat dengan PHP native dan MySQL. Project ini cocok banget buat kalian yang mau belajar web development dengan teknologi yang keren dan modern!
- β CRUD Lengkap - Create, Read, Update, Delete (bisa tambahin, lihat, edit, hapus todo)
- β Filter Status - Bisa filter berdasarkan: Semua, Pending, In Progress, Completed
- β System Priority - Ada prioritas Low, Medium, High dengan warna-warna kece
- β Responsive Design - Pake Bootstrap 5, jadi mobile-friendly
- β Validasi Form - Ada validasi input dan error handling
- β
Docker Ready - Tinggal
docker-compose up
langsung jalan! - β CI/CD Pipeline - Ada GitHub Actions buat testing otomatis
Tampilan utama dengan daftar todo dan form untuk menambah todo baru
Halaman detail todo dengan fitur edit inline
Tampilan mobile yang responsive dan user-friendly
Interface phpMyAdmin untuk manage database
php-todo/
βββ π index.php # Halaman utama (daftar todo)
βββ π detail.php # Halaman detail todo
βββ βοΈ config.php # Konfigurasi database
βββ π§ functions.php # Helper functions
βββ ποΈ database.sql # Schema database + sample data
βββ π actions/ # Folder untuk proses CRUD
β βββ create.php # Proses tambah todo
β βββ update.php # Proses update todo
β βββ delete.php # Proses hapus todo
βββ π¨ assets/
β βββ style.css # Custom styling CSS
βββ π .github/workflows/
β βββ ci.yml # GitHub Actions workflow
βββ π³ Dockerfile # Docker config untuk PHP-FPM
βββ π Dockerfile.nginx # Docker config untuk Nginx
βββ βοΈ nginx.conf # Config Nginx (simplified untuk mahasiswa)
βββ π³ docker-compose.yml # Docker Compose configuration
βββ π NGINX_GUIDE.md # Panduan Nginx untuk mahasiswa
βββ π README.md # File ini
- π Web Server: Nginx 1.25 (Alpine) - Web server yang kenceng banget!
- β‘ Backend: PHP 8.1 dengan PHP-FPM - PHP versi terbaru dengan performa mantap
- ποΈ Database: MySQL 8.0 - Database yang reliable dan populer
- π¨ Frontend: HTML5, CSS3, JavaScript (vanilla), Bootstrap 5 - No framework JS yang ribet!
- π³ Containerization: Docker & Docker Compose - Bikin deployment gampang banget
- π CI/CD: GitHub Actions - Testing otomatis setiap push code
Aplikasi ini menggunakan satu tabel todos
dengan struktur:
Field | Type | Constraint | Deskripsi |
---|---|---|---|
id |
INT | PRIMARY KEY, AUTO_INCREMENT | ID unik todo |
title |
VARCHAR(255) | NOT NULL | Judul todo |
description |
TEXT | NULLABLE | Deskripsi detail todo |
status |
ENUM | 'pending', 'in_progress', 'completed' | Status todo |
priority |
ENUM | 'low', 'medium', 'high' | Prioritas todo |
created_at |
TIMESTAMP | DEFAULT CURRENT_TIMESTAMP | Waktu dibuat |
updated_at |
TIMESTAMP | AUTO UPDATE | Waktu terakhir diupdate |
Docker itu seperti "kotak virtual" yang berisi semua yang dibutuhkan aplikasi kita untuk jalan. Jadi aplikasi kita bisa jalan di komputer siapa aja tanpa ribet install-install dependency!
Docker Compose itu tools buat manage banyak container sekaligus. Dalam project ini kita punya 4 container:
- π Nginx Container - Web server yang handle request HTTP
- β‘ PHP-FPM Container - Processor untuk file-file PHP
- ποΈ MySQL Container - Database server
- π§ phpMyAdmin Container - Interface buat manage database
FROM php:8.1-fpm # Base image PHP-FPM
WORKDIR /var/www/html # Set working directory
RUN docker-php-ext-install pdo_mysql # Install extension MySQL
# TIDAK COPY file - pakai volume mounting!
CMD ["php-fpm"] # Jalanin PHP-FPM
FROM nginx:1.25-alpine # Base image Nginx (ukuran kecil)
COPY nginx.conf /etc/nginx/conf.d/ # Copy config Nginx kita
# TIDAK COPY file aplikasi - pakai volume mounting!
CMD ["nginx", "-g", "daemon off;"] # Jalanin Nginx
- Live Reload: Edit code langsung keliatan tanpa rebuild!
- Development Mode: Perfect buat mahasiswa yang lagi belajar
- Faster Development: Gak perlu restart container setiap edit file
- Real-time Changes: Edit CSS/PHP langsung refresh browser aja
- No Auto Restart: Container yang mati TIDAK auto restart
- Learning Troubleshooting: Mahasiswa belajar debug container issues
- Real World Skills: Persiapan buat production environment
services:
nginx: # Service web server
build:
dockerfile: Dockerfile.nginx
ports:
- "8080:80" # Port mapping
php: # Service PHP processor
build: .
depends_on:
- mysql # Tunggu MySQL dulu
mysql: # Service database
image: mysql:8.0
environment:
- MYSQL_ROOT_PASSWORD=root_password
-
Clone repository ini:
git clone <repository-url> cd php-todo
-
Jalanin aplikasi (cuma satu command!):
docker-compose up -d
-d
artinya detached mode (jalan di background) -
Akses aplikasi:
- π± Todo App: http://localhost:8080
- ποΈ phpMyAdmin: http://localhost:8081 (username:
root
, password:root_password
)
-
π₯ Development Mode - Edit & Langsung Keliatan!
# Edit file PHP/CSS apa aja vim index.php # Refresh browser -> langsung update! π # TIDAK PERLU rebuild container!
-
Stop aplikasi:
docker-compose down
-
Install requirements:
- PHP 8.1+ dengan extension PDO MySQL
- MySQL 8.0+
- Web server (Apache/Nginx)
-
Setup database:
mysql -u root -p < database.sql
-
Konfigurasi database di
config.php
-
Jalanin lewat web server
Aplikasi ini support environment variables (bisa diubah lewat docker-compose.yml):
DB_HOST
- Host database (default: mysql)DB_NAME
- Nama database (default: todo_app)DB_USER
- Username database (default: todo_user)DB_PASS
- Password database (default: todo_password)
Project ini udah include automated testing via GitHub Actions yang keren:
- β PHP Syntax Validation - Ngecek syntax PHP bener atau nggak
- β Database Connection Testing - Test koneksi ke database
- β CRUD Operations Testing - Test semua fitur CRUD
- β Security Checks - Ngecek keamanan aplikasi
- β Docker Build Testing - Test build Docker image
# Validasi syntax PHP
find . -name "*.php" -exec php -l {} \;
# Test dengan Docker
docker-compose up -d
# Akses http://localhost:8080 dan test manual
docker-compose down
- Isi form di halaman utama
- Wajib: Title (max 255 karakter)
- Optional: Description (max 5000 karakter)
- Pilih priority dan status
- Klik tombol "Add Todo"
- Halaman utama nampilin semua todo dalam bentuk tabel
- Pake tombol filter buat nampilin status tertentu
- Klik "View" buat lihat detail lengkap
- Todo diurutkan berdasarkan tanggal dibuat (terbaru duluan)
- Klik "Edit" dari halaman utama atau tombol "Edit" di detail view
- Ubah field yang mau diubah
- Klik "Update Todo" buat save perubahan
- Klik "Delete" dari daftar todo mana aja
- Konfirmasi hapus di popup
- Todo akan dihapus permanen
- β Pencegahan SQL Injection - Pake prepared statements
- β Proteksi XSS - HTML escaping di semua output
- β Validasi Input - Input divalidasi dan disanitasi
- β Session-based Messaging - Pesan error/sukses pake session
- β Environment Variables - Data sensitif disimpan di env vars
π± User Request β π Nginx β β‘ PHP-FPM β ποΈ MySQL
β
π¨ Static Files (CSS/JS)
- Performance π - Lebih cepat dari Apache+mod_php
- Scalability π - Bisa handle lebih banyak request
- Modern π‘ - Industry standard untuk aplikasi PHP
- Separation of Concerns ποΈ - Web server dan PHP processor terpisah
- PHP PSR-12 coding standards
- Bootstrap 5 components untuk UI
- Responsive design principles
- Clean, semantic HTML
- Fork repository ini
- Bikin feature branch baru
- Commit changes kalian
- Bikin pull request
- Wait for review! π
- NGINX_GUIDE.md - Panduan lengkap Nginx untuk mahasiswa
- DEVELOPMENT_GUIDE.md - Panduan development dengan live reload
- TROUBLESHOOTING.md - Panduan fix container yang mati (WAJIB BACA!)
- SCREENSHOT_GUIDE.md - Cara ambil screenshot untuk dokumentasi
- Database Schema - Lihat di file
database.sql
- Docker Docs - https://docs.docker.com/
- PHP Official Docs - https://www.php.net/docs.php
Project ini menggunakan MIT License - bebas dipake buat belajar!
Kalau ada masalah atau pertanyaan:
- Cek dulu NGINX_GUIDE.md dan README.md ini
- Lihat di Issues GitHub repository
- Kalau masih stuck, bikin issue baru dengan detail yang jelas
Happy Coding! πβ¨
Made with β€οΈ for CCIT Students