slim-3 Questions
6
Solved
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();
...
3
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 do...
4
Solved
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);
}...
8
Solved
I am trying to use the ValidationErrorsMiddleware.php class as a middleware, so I added the following code to my bootstrap/app.php:
$app->add(new App\Middleware\ValidationErrorsMiddleware($cont...
Limpkin asked 18/5, 2016 at 7:46
4
Solved
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-&...
4
Solved
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', '\Controller\Acc...
Latona asked 9/4, 2016 at 18:53
4
Solved
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, $res...
1
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,
$containe...
Locution asked 26/10, 2017 at 0:11
1
When running the PHP Development server on my MacOS I get the following error from composer.
Fatal error: Cannot redeclare composerRequire01a3dc0b1f885ed2b645be37711584c1()
(previously declared i...
Brython asked 1/10, 2017 at 0:14
1
Solved
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 \Ps...
3
Solved
Before the Slim 3 is released, codes below work fine:
settings.php,
return [
'settings' => [
'displayErrorDetails' => true,
'modules' => [
'core' => 'config/core/modules.php',
'l...
1
Solved
I'd like a route that parses and puts together an array of GET parameters to redirect to another route that expects GET parameters.
I had hoped this would work, where I pass $search_params as part...
Bathyal asked 17/1, 2017 at 17:15
2
Solved
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 midd...
1
Solved
I'm trying to build a full REST API with Slim 3. It was quite easy with Slim 2. But now I've got some issues.
The POST and PUT route does not work has expected. I can't get the parameters.
I found...
1
Solved
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(...
Drury asked 26/4, 2016 at 16:13
1
Solved
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 ...
Donoghue asked 25/4, 2016 at 16:9
1
Solved
I have route:
$app->get('/admin/login/{status}', 'App\Controller\Admin\AdminController:loginAction')
How do I make {status} parameter optional?
Chamonix asked 20/3, 2016 at 14:2
1
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 ...
2
Solved
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:
<?php
namespa...
2
Solved
In Slim 2, I can over write the default 404 page easily,
// @ref: http://help.slimframework.com/discussions/problems/4400-templatespath-doesnt-change
$app->notFound(function () use ($app) {
$v...
1
© 2022 - 2024 — McMap. All rights reserved.