Features:
- PSR autoloading
- Exception middleware
- PDO Database service (configure DB in api/DataLayer/Database.php)
- Product CRUD (id,name,size,is_available)
- Custom action routing: /api/v1/{controller}/{customMethod}
- Swagger annotations (swagger.php + app/Docs/*.php)
Setup:
- Unzip into your htdocs (e.g., D:/xampp/htdocs/php-api-psr4)
- Run: composer install
- Create database and table (see app/Config/sql.sql)
- Adjust DB credentials in api/DataLayer/Database.php
- Start Apache or run: php -S localhost:8000 -t public
- Access API via: http://localhost/php-api/api/v1/products