Posts

Geoffrey Nyachae Henry

Image
Create A Simple REST API in PHP? Step By Step Guide! Lets go Previously, we learned how to create, read, update and delete database records (CRUD operations) with our PHP, MySQL & OOP CRUD Tutorial. Today, before we go to JavaScript programming, we will learn how to create a simple REST API in PHP. Enjoy our step-by-step tutorial below! This post covers the following topics: 1.0 Project Overview 1.1 What is REST API? 1.2 Why do we need REST API? 1.3 Where REST API is used? 1.4 REST API in our tutorials 2.0 File Structure 3.0 Setup the Database 3.1 Create Categories Table 3.2 Dump Data For Categories Table 3.3 Products Table 3.4 Dump Data For Products Table 3.5 Connect to database 4.0 Read Products 4.1 Product Object 4.2 Create “read.php” file 4.3 Add Product “read()” method 4.4 Output 5.0 Create Product 5.1 Create create.php file 5.2 Product create() method 6.0 Read One Product 6.1 Create read_one.php file 6.2 Product readOne() m...