Book Management API (PHP MongoDB) - angelzoee/books-api-crud GitHub Wiki
Setup
Requirements:*
- PHP (8.x recommended)
- MongoDB extension for PHP
- Apache (via XAMPP/WAMP or standalone)
- db.php file with MongoDB connection
Endpoints
- Create a Book
- URL:
/create.php
- Method:
POST
- Headers:
Content-Type: application/json
- Body (JSON):
{ "title": "The Alchemist", "author": "Paulo Coelho", "year": 1988, "genre": "Adventure" }
- Read a Book
- URL:
/read.php
- Method:
GET
- Headers:
Content-Type: application/json
- Update a Book
- URL:
/update.php
- Method:
PUT
- Headers:
Content-Type: application/json
- Body (JSON):
{ "_id": "682a958baf08c3f289b71236", "title": "To Kill a Mockingbird - Updated" }
- Delete a Book
- URL:
/delete.php
- Method:
DELETE
- Headers:
Content-Type: application/json
- Body (JSON):
{ "_id": "682c247541497e18c202bcf4" }