marcj / php-rest-service

Php-Rest-Service is a very simple and fast PHP class for server-side RESTful JSON APIs.
MIT License
216 stars 74 forks source link

Fail to bind create #5

Closed ntvsx193 closed 11 years ago

ntvsx193 commented 11 years ago

Fail to bind by method create does not equal /

set router

RestService\Server::create('/v1', new Api\Router)
    ->setDebugMode(true)
    ->collectRoutes()
->run();

controller

namespace Api;
class Router {
    /**
     * @param int $server_id
     * @url stats/([0-9]+)
     * @url stats
     * @return array
     */
    public function getStats($server_id = 0){
        return ['id' => $server_id];
    }
}

+ GET /v1 + GET /v1/stats + GET /v1/stats/5 All response empty. If first argv of method create('/', ...all works

marcj commented 11 years ago

Thanks. I've fixed that issue. Can you check the newest version? Updated the 0.1.3.

ntvsx193 commented 11 years ago

Good, now it works!