I’m using SLIM 3.5.0 for creating a rest api. I use Angular2 to talk to the API.
The app->get() routes do work fine! The app->delete() routes doesn’t work unfortunately. I always get an internal server error 500 if i use the delete route. Even if i remove all that’s inside it and just echo the id:
$app->delete('/news/{id}', function ($request, $response, $args) {
echo $args['id'];
});
above this route i have a get /news route that is working fine. Even if i replace delete with get, it’s just working fine.
I also have a SLIM v2 version on another directory, and if i call the delete route there, it is just working fine.
So does anybody see what i’m doing wrong? I’m sure it’s not Angular, beceause also with another REST client i get the 500 error. It’s not the server, because the v2 api is working with delete. So it must be something with the v3 slim i guess…
Fixed!! The problem was on the webserver with multiple php versions conflicting. phpinfo gave 5.6.24, but 5.3.x was used for the Verbs other then get, post or head.
Thanks all!
In addition: the parse error was because php version < 5.4 don’t supports short array syntax. So for delete and put methods, the 5.3 version was used.