A micro REST API application, that simply does execute CRUD (create, read, update, and delete) actions.
Note: This application was created using plain PHP with a couple of third-party libraries including Doctrine DBAL and phpdotenv for configuring database connection.
To install, you simply clone this repository:
$ git clone https://github.com/MorganGonzales/php_api_crud
Then install its dependencies using Composer.
$ composer install
Afterwards, initilize your database using the board_games.sql
provided in the repository.
Finally, copy .env-example
as .env
with the proper database configuration parameters set.
URL: http://php-api-crud.herokuapp.com/api/board-games/create.php Action: POST Sample Body:
{
"name":"Pandemic",
"short_description":"Your team of experts must prevent the world from succumbing to a viral pandemic.",
"description":"In Pandemic, several virulent diseases have broken out simultaneously all over the world! The players are disease-fighting specialists whose mission is to treat disease hotspots while researching cures for each of four plagues before they get out of hand.",
"year_published":"2008",
"designer":"Matt Leacock",
"publisher":"Z-Man Games, Inc."
}
URL: http://php-api-crud.herokuapp.com/api/board-games/read.php Action: GET
URL: http://your-host/api/board-games/update.php Action: PUT Sample Body:
{
"id":"4",
"name":"Pandemic Iberia",
"short_description":"Your team of experts must prevent the world from succumbing to a viral pandemic.",
"description":"In Pandemic, several virulent diseases have broken out simultaneously all over the world! The players are disease-fighting specialists whose mission is to treat disease hotspots while researching cures for each of four plagues before they get out of hand.",
"year_published":"2008",
"designer":"Matt Leacock",
"publisher":"Z-Man Games, Inc."
}
URL: http://php-api-crud.herokuapp.com/api/board-games/delete.php Action: DELETE Sample Body:
{
"id":"4",
}
URL: http://php-api-crud.herokuapp.com/api/board-games/search.php Action: POST Sample Body:
{
"designer":"Matt Leacock",
}