🖐 Hi there, this is a simple REST API built using the Slim framework. And this is for the folks who are just getting started with APIs in Slim. I've built this simple REST API that contains all CRUD operations. As an example, I've taken a student database with just name, address, and age as its table columns and have performed CRUD operations on it using APIs. Feel free to use this code and work around it. Hope you got the insights!
/routes/students.php folder contains all API methods for the CRUD operations
/config folder contains Mysql database configurations
/db folder contains database(.sql) file
/public folder contains a single index.php to instantiate the app.
-
Well, first clone or download this repo.
-
Create a database and import db/studentdb.sql file in your database.
-
Change database configurations in config/Database.php file.
-
Install Composer and run 'composer update' to install all the packages mentioned in composer.json file.
-
Additionally, create a virtual host as mentioned in this site: Creating a virtual host in Windows
-
Check your endpoints.
http://localhost/rest_api_with_slim/students/get
http://localhost/rest_api_with_slim/students/get/17
http://localhost/rest_api_with_slim/students/post
http://localhost/rest_api_with_slim/students/put/29
http://localhost/rest_api_with_slim/students/delete/29
Please give me a star⭐ to this repo, I'll be happy😊.