https://github.com/andhikayuana/car-gallery-api
Simple CRUD API using Slim Framework
https://github.com/andhikayuana/car-gallery-api
crud-api php simple-api slim-framework slim3
Last synced: 7 months ago
JSON representation
Simple CRUD API using Slim Framework
- Host: GitHub
- URL: https://github.com/andhikayuana/car-gallery-api
- Owner: andhikayuana
- Created: 2018-05-20T07:30:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-12T13:16:39.000Z (almost 7 years ago)
- Last Synced: 2025-01-18T03:45:54.756Z (9 months ago)
- Topics: crud-api, php, simple-api, slim-framework, slim3
- Language: PHP
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# Car Gallery API
## Requirements
* Web server with URL rewriting
* PHP 7 or latest
* PostgreSQL 10.4 or latest
* [Composer](https://getcomposer.org/)
* [Git](https://git-scm.com/)## Installation
* Clone this repository using `git`
```bash
git clone git@github.com:andhikayuana/car-gallery-api.git
```* Install depdendencies using `composer`
```bash
$ cd car-gallery-api
$ composer install
```* Import [this database](https://github.com/andhikayuana/car-gallery-api/blob/master/db_rest.sql) on your local machine
* Setup your environment database to [src/settings.php](https://github.com/andhikayuana/car-gallery-api/blob/master/src/settings.php#L18)## Runninng
To run this API using this command
```bash
cd public
php -S localhost:3000
```
Access `localhost:3000` using postman or your web browserand now you can see like this
```json
{
"name": "Cars API",
"version": "1.0.0"
}
```## How to use this API
```
[GET] /cars | get all cars
[GET] /cars/{id} | get cars by id
[POST] /cars | insert cars
body [raw] :
{
"year": "2011",
"make": "honda",
"model": "mobilio"
}
[PUT] /cars/{id} | update cars
body [raw] :
{
"year": "2015",
"make": "halo",
"model": "world"
}
[DELETE] /cars/{id} | delete by id
```