

PHP RESTful API with an example MySQL database. - karlhadwen
https://github.com/karlhadwen/RESTful-API
I recently finished a small RESTful API project for a University project and thought it would be good to upload it to Github as an example as to how a RESTful API should function and work, as I know its hard to find a clear cut solution to RESTful API standards.<p>Here&#x27;s a little description of what&#x27;s included:<p>PHP RESTful API with an example MySQL database. Comes with various HTTP server response mechanisms, basic HTTP authentication, pagination and rate limits. Do note this API sends a delete request using the JSON body rather than using an ID within the URI.<p>Feel free to reuse it as you wish.
======
blueicelt2004
I like this but just something small, in api.php at line 341/345 you check if
$table is articles and inside the same ifcheck you check again, the same thing
is done at 412/416

    
    
    		} else if ($table=="articles") {
    			if (empty($data->article_id)) {
    				$this->data_object->send_response(400);
    			} else {
    				if ($table=="articles") {

~~~
karlhadwen
Didn't spot that, will take a look, thanks!

------
trillcode
I love this for instructional purposes. It is also good for when a very
lightweight api is needed. I like how it used more modern OO based php and not
some procedural mess. I just thought Id give some positive feedback bro !

~~~
karlhadwen
Thank you!

------
krapp
Upvoted for using PDO.

