Questions tagged [slim-3]

Slim 3 is the successor to Slim 2, a micro framework for PHP.

Resources

Related tags


For the Ruby template engine use instead.

421 questions
3
votes
2 answers

Exclude route from Slim CSRF middleware

I'm working on a Slim 3 based application with a Twig frontend and I'm also making a REST API. I've implemented slimphp\Slim-Csrf for the entire app but I now want to exclude this CSRF check from every "API" routes. I'm trying to implement the…
joedu12
  • 33
  • 1
  • 6
3
votes
2 answers

Run a function after returning response

I have an API created with Slim 3. In it I have some curl execution such as sending Push notification to a user. I want send response to requester then execute curl or any other function. I read about Threads in PHP and use pthreads-polyfill but it…
3
votes
1 answer

Slim3 - Argument 1 passed to constructor must be instance of Slim\Views\Twig

I'm using Slim3, but I'm having an issue registering a dependency. According to the error the constructor I created expects the type of argument 1 to be Slim\Views\Twig. The problem is I am passing an instance of Slim\Views\Twig - at least I think I…
BugHunterUK
  • 8,346
  • 16
  • 65
  • 121
3
votes
2 answers

Redirecting with error on Slim Framework

I want to redirect to a page (error.php, or maybe 404/406.php, whatever the error is) depending on the info in a form in my website. I managed to log an error like this: if ($date > $curdate) { return $response ->withStatus(406) …
Newwt
  • 491
  • 1
  • 5
  • 22
3
votes
1 answer

Slim 3 - Error is not shown

I am trying to use zeuxisoo/slim-whoops to show errors, but for some reason I am only getting white screen without any message show. This is the code I am using (I don't know if it does matter, I am using quick PHP host (php -S…
Sasha
  • 8,521
  • 23
  • 91
  • 174
3
votes
1 answer

Slim 3 sending data between middlewares

I want to send data between one middleware to other. As one middleware passes, I want to add some JSON response and pass to next middleware. What can be the best possible way to do it in Slim 3. For…
Mehul Jain
  • 113
  • 1
  • 8
3
votes
1 answer

Catchable fatal error with Slim 3 in my Models, must implement interface Interop\Container\ContainerInterface

I am getting an Catchable fatal error with Slim 3 on my Models, i have a similar set up on my Controllers and it works just fine. When i implement the same on my Modal class i get the following error. Catchable fatal error: Argument 1 passed to…
John
  • 111
  • 10
3
votes
1 answer

How to check the url in the controller slim-framework

I have problem with slim I have the controllar, and 2 routs send to this controller. The page html with teig. The api and show that in json. Now I need to check, if I request with this url: /product/{slug} return the twig (I do the return). and…
HaiZone
  • 81
  • 1
  • 4
3
votes
1 answer

Multiple Slim routes with the same signature

We are looking at using Slim 3 as the framework for our API. I have searched SO and the Slim docs, but cannot find an answer to the issue. If we have different route files (e.g. v1, v2, etc.) and if two routes have the same signature, an error is…
TheAnswerIs42
  • 55
  • 1
  • 7
3
votes
3 answers

Access current route name in Slim3 controller's class constructor

With Slim I group my controllers and generally have an abstract BaseController I extend for each group. I use class based routing: /* SLIM 2.0 */ // Users API - extends BaseApiController $app->post('/users/insert/' ,…
Eko3alpha
  • 540
  • 6
  • 16
2
votes
0 answers

Slim Php v3 query string

I would like to know if there is any way to define a specific controller for query strings like: $app->group('/contacts', function() { $this->get('', 'ContactController:index'); $this->get('?*', 'ContactSearchController:index'); }); I want to…
Hebert Lima
  • 186
  • 2
  • 10
2
votes
1 answer

How should the domain object and data mapper interact within a service class for an auth system using MVC

I’m creating an authentication / login system using Slim 3 PHP on the back-end and Angular on the front-end and I’m trying to understand the ‘domain object’ and ‘data mapper’ part of a model layer within an MVC structure. I’ve read a lot of useful…
SneakyShrike
  • 723
  • 1
  • 10
  • 31
2
votes
1 answer

Respect Validation php slim custom messages

I've read the docs and I wonder if its possible to make custom messages based on rules AND attribute, for example I have the following code $casoValidator = …
JoseCarlosPB
  • 933
  • 2
  • 14
  • 29
2
votes
2 answers

Slim 3 PHP - can't access values in settings.php from middleware.php

I have a midleware that checks for a valid signature on a JWT token for GET requests to private routes. In it, I need to supply my JWT secret which is stored in settings.php at ['settings']['jwt']['secret']. I tried accessing this value using…
Daveh0
  • 952
  • 9
  • 33
2
votes
1 answer

Howto use Quasar with SlimPHP and Twig

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs. Twig is a fast, secure, and flexible PHP template engine. The challenge is to use these two components and use Quasar Framework too.…
Edgar Koster
  • 479
  • 1
  • 5
  • 18
1 2
3
28 29