Sergey Zhuk: Building a RESTful API Using ReactPHP and MySQL
syndicated from www.phpdeveloper.org
on February 25, 2019
In a recent post to his site, Sergey Zhuk walks through the process for building a REST API with ReactPHP and MySQL and a bit of help from a simple routing package to handle the requests.
Today we will be looking at creating a RESTful API using ReactPHP, MySQL and nikic/FastRoute. Let’s look at the API we want to build and what it can do.
He then steps through the development of the REST API:
- showing the file structure of the resulting application
- installing dependencies
- the code to set up the HTTP server for handling requests (using React)
- building out the database with a user table
He then gets into the main part of the tutorial, showing the build out of each of the routes for the CRUD operations (Create, Read, Update, Delete). He provides both the code to make the endpoint work and examples of the requests they handle.