Simple and effective multi-format Web API Server to host your PHP API as Pragmatic REST and / or RESTful API
Say I have a route defined this way:
/**
* test post
*
* @url POST {id}
* @param int $id Id of the artifact {@from body}
* @param array $values Artifact fields values {@from body}
*
* @return int
*/
protected function post($id, array $values) {
var_dump($values);
return 4;
}
if I input this:
<response><item><some-property>123</some-property></item></response>
I will have:
array (
'0' => array (
'some-property' => 123
)
)
which is correct by the way, and what the fixes targets
<values>
matches @param array $values
as a name
//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;
}