Simple and effective multi-format Web API Server to host your PHP API as Pragmatic REST and / or RESTful API
//make sure you add a use statement on top
use Luracast\Restler\Format\XmlFormat;
//in your api class add the method with a @class comment
/**
* test post
*
* @url POST {id}
* @param int $id Id of the artifact {@from body}
* @param array $values Artifact fields values {@from body}
*
* @return int
*
* @class XmlFormat {@defaultTagName values}
*/
protected function post($id, array $values) {
var_dump($values);
return 4;
}
I have this:
$restler->addAuthenticationClass('\\Tuleap\\REST\\TokenAuthentication');
$restler->addAuthenticationClass('\\Tuleap\\REST\\BasicAuthAuthentication');
Is there a way to say to Restler that if TokenAuthentication fails it has to fallback to the next authentication class? Or do I have to do a mixed authentication class that deals with the two authentication types?
this is my controller file under app/controller Lorem.php
<?php
class Lorem {
function index(){
return 'aaa';
}
}
here is my public/index.php
use Luracast\Restler\Restler;
$r = new Restler();
$r->addApiClass('Lorem');
$r->addAPIClass('Resources');