A PHP OOP learning project demonstrating:
- Abstract classes and inheritance
- Polymorphism (no if-else for product types)
- PSR-4 autoloading
- PDO database operations
- MVC-like architecture
- PHP 8.2
- MySQL/MariaDB
- HTML/CSS/JavaScript (Vanilla)
| Type | Special Attribute |
|---|---|
| DVD | Size (MB) |
| Book | Weight (KG) |
| Furniture | Dimensions (HxWxL cm) |
product-management/
├── public/
│ └── index.php # Entry point & router
├── src/
│ ├── Database/ # Database connection (Singleton)
│ ├── Model/ # Product classes (Abstract + Inheritance)
│ ├── Repository/ # Database operations
│ └── View/ # HTML templates
├── config/ # Configuration files
├── css/ # Stylesheets
├── js/ # JavaScript
└── database/ # SQL schema
- PHP 7.4+ (8.0+ recommended)
- MySQL 5.7+ or MariaDB
- Composer
- Apache with mod_rewrite
- Clone the repository
git clone https://github.com/ertancurr1/product-management.git
cd product-management- Install dependencies
composer install- Create database and import schema
mysql -u root -p < database/schema.sqlOr import database/schema.sql via phpMyAdmin.
- Configure database connection
Edit config/database.php with your credentials:
return [
'host' => 'localhost',
'dbname' => 'product_management',
'username' => 'root',
'password' => '',
'charset' => 'utf8mb4'
];- Start your web server and visit:
http://localhost/product-management/public/
- ✅ Add products (DVD, Book, Furniture)
- ✅ View all products in grid layout
- ✅ Mass delete with checkboxes
- ✅ Form validation (client + server side)
- ✅ Dynamic type-specific fields
- ✅ SKU uniqueness validation
| Concept | Implementation |
|---|---|
| Abstract Class | Product base class |
| Inheritance | DVD, Book, Furniture extend Product |
| Polymorphism | getSpecificAttribute() method |
| Encapsulation | Private properties with getters/setters |
| Singleton | Database connection class |
Ertan Curri
- Portfolio: ertancurri.com
- GitHub: @ertancurr1
- LinkedIn: Ertan Curri
This project is open source and available for learning purposes.