A simple PHP class that helps building REST webservices
composer install telabotanica/tb-base-rest-service
class MyService extends BaseRestServiceTB {
public function __construct() {
$config = array(
"domain_root" => "http://sub.mydomain.tld",
"base_uri" => "/my-service-root-folder",
"first_resource_separator" => "/"
);
parent::__construct($config);
}
protected function get() {
// ...
}
protected function post() {
// ...
}
}
- domain_root : root URL of your server
- base_uri : base path of your webservice
- first_resource_separator : first character following your base_uri (typically "/" or ":", defaults to "/")