REST APIs using Slim framework. Implemented all CRUD operations on the MySql database

Overview

PHP REST API using slim framework and CRUD operations

🖐 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!

📧 Contents

/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.

😀 How to use this project

  1. Well, first clone or download this repo.

  2. Create a database and import db/studentdb.sql file in your database.

  3. Change database configurations in config/Database.php file.

  4. Install Composer and run 'composer update' to install all the packages mentioned in composer.json file.

  5. Additionally, create a virtual host as mentioned in this site: Creating a virtual host in Windows

  6. Check your endpoints.

📌 Endpoints

  1. http://localhost/rest_api_with_slim/students/get GET METHOD
  2. http://localhost/rest_api_with_slim/students/get/17 GET METHOD
  3. http://localhost/rest_api_with_slim/students/post POST METHOD
  4. http://localhost/rest_api_with_slim/students/put/29 PUT METHOD
  5. http://localhost/rest_api_with_slim/students/delete/29 DELETE METHOD

📰 License

MIT

❤️ Loved this project?

Please give me a star to this repo, I'll be happy 😊 .

🔗 Let's connect!

linkedin

twitter

twitter

medium

You might also like...
Simple PHP framework that helps you quickly understand and write simple APIs.

Lightweight-PHP-Framework-For-APIs. Simple PHP framework that helps you quickly understand and write simple APIs. Installation Use the package manager

Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily.
Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily.

Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily. Leaf introduces a cleaner and much simpler structure to the PHP language while maintaining it's flexibility. With a simple structure and a shallow learning curve, it's an excellent way to rapidly build powerful and high performant web apps and APIs.

Simple PHP framework that helps you quickly understand and write simple APIs.

Lightweight PHP Framework For Web and APIs PHP framework that helps you write quickly simple but powerful web apps and APIs Installation Use the packa

PhpBoot is an easy and powerful PHP framework for building RESTful/Microservices APIs.
PhpBoot is an easy and powerful PHP framework for building RESTful/Microservices APIs.

🚀 tiny & fast PHP framework for building Microservices/RESTful APIs, with useful features: IOC, Hook, ORM, RPC, Swagger, Annotation, Parameters binding, Validation, etc.

Slim Framework - Prerequisite Checker
Slim Framework - Prerequisite Checker

Slim Framework - Server Configuration Checker Upload the file check.php to your webserver Browse to the file: https://example.com/check.php Check the

A Slim PHP MVC framework built just for fun!

Aura Framework A Slim PHP MVC framework built just for fun! en: Note: This repository only contains the core code of the Aura framework. If you want t

Slim Framework skeleton application with MVC Schema

Slim Framework skeleton application with MVC Schema

This repository contains a library of optional middleware for your Slim Framework application

Slim Framework Middleware This repository contains a library of optional middleware for your Slim Framework application. How to Install Update your co

A curated list of awesome tutorials and other resources for the Slim micro framework

Awesome Slim A curated list of awesome tutorials and other resources for the Slim micro framework Table of Contents Essentials Tutorials Packages and

Owner
Hanoak
Hanoak
Asynchronous server-side framework for network applications implemented in PHP using libevent

phpDaemon https://github.com/kakserpom/phpdaemon Asynchronous framework in PHP. It has a huge number of features. Designed for highload. Each worker i

Vasily Zorin 1.5k Nov 30, 2022
Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.

Slim Framework Slim is a PHP micro-framework that helps you quickly write simple yet powerful web applications and APIs. Installation It's recommended

Slim Framework 11.5k Jan 4, 2023
TrailLamp is a lightweight, easy-to-use Php MVC framework that can be used to build web applications and REST APIs.

TrailLamp Introduction TrailLamp is a lightweight, easy-to-use Php MVC framework that can be used to build web applications and REST APIs. Installatio

Etorojah Okon 14 Jun 10, 2022
The Slim PHP micro framework paired with Laravel's Illuminate Database toolkit.

Slim & Eloquent The Slim PHP micro framework paired with Laravel's Illuminate Database toolkit. Getting started # Download composer curl -s https://ge

Kyle Ladd 111 Jul 23, 2022
Bootcamp project based on PHP-MVC using MySQL database.

Up-Stream This is the implementation of a full website based on PHP MVC. Using MySql database to create a website. And Bootstrap4 for front-end. Start

AmirH.Najafizadeh 4 Jul 31, 2022
Simple WebSocket server implemented in PHP.

Bloatless PHP WebSockets Simple WebSocket server implemented in PHP. Installation Requirements Installation procedure Usage Server Applications Timers

bloatless.org 556 Dec 25, 2022
This Slim Framework middleware will compile LESS CSS files on-the-fly using the Assetic library

This Slim Framework middleware will compile LESS CSS files on-the-fly using the Assetic library. It supports minification and caching, also via Asseti

Gerard Sychay 22 Mar 31, 2020
Slim Framework using Jade for templates

Welcome to Slim-Jade What? This is a boilerplate. It's the Slim Framework with jade.php to render views Why? I like the Sinatra style MVC and love Jad

Joe Fleming 23 Oct 16, 2019
PHP boilerplate for quick start projects using Slim Framework and Eloquent.

Lassi PHP boilerplate for quick projects using Slim Framework and Eloquent database. Lassi is a small PHP boilerplate to use Slim Framework with Eloqu

Jabran Rafique⚡️ 59 Jul 14, 2022