Skip to content

📚 Simple Books api with php, slim framework and MySQL

Notifications You must be signed in to change notification settings

Bruends/simple-php-restful-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Books api

simple CRUD rest api with slim php and mysql

installing and running:

  • first check if you have php >= 7, mysql and composer installed

  • create a database in sql and execute the querys in the books.sql file to create the table.

  • change database config in configDB.php.

  • Install the dependencies with: composer install

  • After previous steps, open the api folder in terminal and start the server with the command: php -S localhost:4000

Endpoints:

api path: http://localhost:4000/index.php/books

all books:

GET    /books

on book by id:

GET    /books/{id}

add book:

POST    /books

and send the body with the json in this format:

{
    title: String, (required)
    author: String,
    book_description: string
}
update book:

PUT    /books

and send the body with the json in this format:

{
    id: int, (required),
    title: String, (required)
    author: String,
    book_description: string
}
delete book:

DELETE    /books/{id}

About

📚 Simple Books api with php, slim framework and MySQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages