Minimalistic code for building RESTful APIs
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

PHP REST Micro Framework

A simplistic micro framework for building an application providing a RESTful API.



Have a look at /example/application.php for a quick start. It creates a Router and the Application, sets up a Route for / that will return a JSON response containing "Hello World!" to the client.

You can use PHP's builtin webserver to test it for yourself!

Start the server by running php -S localhost:8000 example/application.php:

$ php -S localhost:8000 example/application.php
PHP 5.6.2 Development Server started at Tue Sep 22 14:50:29 2015
Listening on http://localhost:8000
Document root is /Users/sebastian/projects/php/restframework
Press Ctrl-C to quit.

Send a request to http://localhost:8000/:

$ curl http://localhost:8000/
    "message": "Hello World!"

Sending requests to other routes or with other HTTP methods will result in a 404 response:

$ curl -X PUT http://localhost:8000/
    "error": {
        "code": 404,
        "message": "No route for put \/"

$ curl http://localhost:8000/foo
    "error": {
        "code": 404,
        "message": "No route for get \/foo"