How I can get all get/ put/ post variables like in Slim 2 for Slim 3?
Slim 2,
$allGetVars = $app->request->get();
$allPutVars = $app->request->put();
$allPostVars = $app->request->post();
How can I do that in Slim 3?
And, for example,…
I've been reading that in Slim v2, $app was bound to the middleware class. I'm finding this not to be the case in v3? Below is my middleware class, but I'm just getting undefined:
We already know how to add a custom 404 notFoundHandler in Slim 3:
$container['notFoundHandler'] = function ($c) {
return function ($request, $response) use ($c) {
return $c->view->render($response, 'pages/404.html.twig')
…
I want to get the name of the current I route in a middleware class. Previously (in Slim 2.*) you could fetch the current route like so:
$route = $this->app->router->getCurrentRoute();
But this function has been removed in the 3.0 version of Slim.…
At the outset, I would like to say - I'm new in unit testing in PHP (phpunit).
In my new project (slim3 framework) I would like to test my controllers for example LoginController.
My idea is (in unit test method)
Create instance of…
I'm am using the Slim Framework Version 3 and have some problems.
$app-> post('/', function($request, $response){
$parsedBody = $request->getParsedBody()['email'];
var_dump($parsedBody);
});
result is always:
null
Can you help me ?
I want to check if a user is logged in. Therefor I have an Class witch returns true or false. Now I want a middleware which checks if the user is logged in.
$app->get('/login',…
I'm trying to download a file using the Slim 3 PHP Framework. Slim 2 was fairly straight forward, as I'm sure Slim 3 is too, but I just don't get it.
Any help would be appreciated.
Based on the documentation here :…
In PhpStorm I get the warning message
"warning method 'withJson' not found" in \Psr\Http\Message\ResponseInterface" at te line:
return $response->withJson($toReturn, 200);
The code:
use \Psr\Http\Message\ServerRequestInterface as Request;
use…
I've been looking all over online and can't find anything that tells you how to assign multiple routes to one callback. For example I want to move:
$app->get('/sign-in', function($request, $response) {
return $this->view->render($response,…
I'm using Slim Framework 3 to create an API. The app structure is: MVCP (Model, View, Controller, Providers).
Is it possible to have Slim Dependency Inject all my classes?
I'm using composer to autoload all my dependencies.
My directory structure…
I'm using a slimframwork 3 app on laradock (nginx, mariadb, phpfpm, php 5.6) so I made a stupid syntax error:
$view->addExtension(new \Slim\Views\TwigExtension(
$container->router,
$container->request->getUri(),
));
the comma after the getUri() was…
I'm using slim-jwt-auth to create token based authentication for a JSON API.
The docs are very helpful, but one thing I don't understand is how are the tokens generated? The docs say that the middleware is able to decode the token, but can't see any…