API for CRUD Operations in PHP

Often, an API is created for CRUD operations. Let's outline an example of such an API.

Read All

Let the following URL return all records from the database:

urlGET http://api.loc/index.php?action=all

Read One

Let the following URL return one record from the database by its id:

urlGET http://api.loc/index.php?action=get&id=1

Delete

Let the following URL delete one record from the database by its id:

urlGET http://api.loc/index.php?action=del&id=1

Update

Let the following URL accept new data for a database record via the POST method and update that record by its id:

urlPOST http://api.loc/index.php?action=edit&id=1
Задание 1

Implement the described API.