https://github.com/damir-sijakovic/tinyphpapi
Tiny PHP web api
https://github.com/damir-sijakovic/tinyphpapi
example minimalistic php webapi
Last synced: 10 months ago
JSON representation
Tiny PHP web api
- Host: GitHub
- URL: https://github.com/damir-sijakovic/tinyphpapi
- Owner: damir-sijakovic
- Created: 2021-04-30T05:11:04.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-30T05:12:43.000Z (almost 5 years ago)
- Last Synced: 2025-01-30T05:43:02.317Z (about 1 year ago)
- Topics: example, minimalistic, php, webapi
- Language: CSS
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Tiny PHP API
Example on:
* how to use JS fetch() function
* how to enable CORS
* how to get POST data
* how to handle Query String
* how to return JSON
* how to handle XHR returns
I'm using custom wrapped fetch function that returns:
* {success:"data"} normal controller return.
* {fail: "No db data found!"} controller failed.
* {error: "404, Not Found"} XHR error.
### Getting started
Run in terminal:
php -S localhost:8080
firefox localhost:8080
### Licence
MIT