I enjoy using Slim, but am frustrated on how to debug it. Lets say I have the following routing. I can do a cURL request, and see the output, but instead I wish to go through the script line by line with my IDE debugger which happens to be NuShere's phpED. While I haven't quick figured it out, I am pretty sure I can make phpED do a POST request, but definitely not a PUT or DELETE request, so there is no point.
Is there any way to do so? I can force $_SERVER['REQUEST_URI']
and $_SERVER['REQUEST_METHOD']
to any value easy enough, and can also change the $_GET
superglobal, but body data (i.e. $_POST
) isn't so simple.
<?php
$app = new \Slim\Slim();
$app->get('/books/:id', function ($id) {
//Show book identified by $id
});
$app->post('/books', function () {
//Create book
});
$app->put('/books/:id', function ($id) {
//Update book identified by $id
});
$app->delete('/books/:id', function ($id) {
//Delete book identified by $id
});
$app->get('/toys/:id', function ($id) {
//Show toy identified by $id
});
$app->post('/toys', function () {
//Create toy
});
$app->put('/toys/:id', function ($id) {
//Update toy identified by $id
});
$app->delete('/toys/:id', function ($id) {
//Delete toy identified by $id
});