A simple RESTful API for managing products inventory built with pure PHP.
- Create new products (POST /api/products)
- Get all products (GET /api/products)
- Get specific product by ID (GET /api/products/{id})
- Update existing products (PUT /api/products/{id})
- POST
/api/products
- Body: JSON with product data
- Example:
{ "name": "Test Product", "description": "Test description", "price": 99.99, "quantity": 10 }
-> GET /PHP-API-Ass/data/products.json
-> GET /PHP-API-Ass/api/products/{id}
-> PUT /PHP-API-Ass/api/products/{id} -> Body: JSON with fields to update
-
XAMPP Setup: -> Download and install XAMPP -> Start Apache server
-
Project Setup: ->Clone this repository to htdocs folder: C:\xampp\htdocs\PHP-API-Ass
-> Ensure the data/ directory is writable -
API Testing -> Use Postman or curl to test the endpoints -> API Base URL: http://localhost/PHP-API-Ass/api/
-> Build with pure PHP (no frameworks) -> JSON file-based storage -> Propeer error handling and validation -> Restful API design patterns
-> Email: gravindra.dev@gmail.com
-> GitHub: https://github.com/CheapStudent
PHP-API-Ass/
├── api/
│ ├── config.php
│ └── products.php
├── data/
│ └── products.json
├── .htaccess
└── README.md