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.

414 questions
0
votes
1 answer

Get param in Routing - Slim Framework 3

How can I get the param in this case? $this->get('/{id}', function($request, $response, $args) { return $response->withJson($this->get('singleSelect')); }); $this->appContainer['singleSelect'] = function ($id) { return…
0
votes
1 answer

How to view files sent through x-sendfile as GET response

I am using Slim Framework 3. Here's my code: .... $response = $response->withStatus(200) ->withHeader('X-Sendfile', $path) ->withHeader('Content-Type', $contentType) …
Samar Rizvi
  • 190
  • 9
0
votes
1 answer

Create routes with controllers in Slim 3 like in Laravel 5

With the PHP framework Slim 3 in Routes, I did this: // In routes : $app->get('article/{id}-{slug}', function ($request, $response, $args) { $class = new Site\ArticleController($args); $class->show(); }); // In controllers : public function…
stephweb
  • 97
  • 11
0
votes
1 answer

Slim Framework DB Service Exception Handling

I'm upgrading to slim v3. How should I use a database connection? I'm thinking about a service injected with pimple: DBConnection final class DBConnection { private $db; public function __construct() { try { // Code to…
Jumpa
  • 3,731
  • 9
  • 41
  • 86
-1
votes
1 answer

Controller not found in slim 3

I am new to slim,so please bear with me. I have project structure like \slim   \public     index.php        \src     \controllers \reports        BillingReportController.php \routes router.php \config …
-1
votes
1 answer

How to simplify if else with four different conditions

How can I simplifyy this code of mine?
ghabriel
  • 113
  • 8
-1
votes
1 answer

Organize Slim 3 API routes logic into functions

I would like structure the API in order to separate both the routing organization from actions in separate files. The current code does not return any errors, but the parameters are not collected correctly. Is there a simple way to organize into…
Qu4k3
  • 173
  • 2
  • 15
-1
votes
1 answer

Recieving a 405 error, Method not allowed, when using a form to get data from the client

I'm Using the Slim framework and trying to get a basic form up and running with some php scripting. Index.php contains a form that when submitted will execute a second php script called request_variable.php, which will output the contents of the…
-1
votes
2 answers

API doesn't allow text

I've just created a simple API for a CAD/MDT I'm working on, I've managed to get it to show the correct information when I do /citations/userid/1. This will then display all the correct values from the SQL database however, if I do…
-1
votes
1 answer

Pass Data between route in Slim

I am new to slim and I want to pass Data between two routes (apps) $app->get('/answer', function (Request $request, Response $response) use($talk,$voiceName,$message){ // submit this data $request =…
-1
votes
1 answer

Bundle JS and CSS for a PHP Web application?

I am building a website using PHP and Slim framework. I have about 12 Javascript files and 8 CSS files and am looking to bundle them in order to decrease the number of HTTP requests. I have come across webpack and require js that might help with…
Saish Sk
  • 17
  • 2
-1
votes
2 answers

Slim Api Using $settings $logger and $db in __construct from dependencies.php in a Model function

Good morning How Can I use $settings $logger and $db in __construct from the $container in dependencies.php in a Model function in a Slim Api? I have the following setup for my Slim framework Api: settings.php (has $settings $looger and $db in…
j00ls
  • 95
  • 2
  • 14
-1
votes
1 answer

Pachico Slim/swoole and Eloquent ORM

i have setup the below library: https://github.com/pachico/slim-swoole but when I try to run a query with Eloquent ORM I can not, it takes to much time until it gives an error I understand that I can not use PDO with async framework but how can I…
Ratchet
  • 53
  • 1
  • 3
  • 10
-1
votes
1 answer

CORS errors on REACTJ + SlimPhP

I'm having some issues with an Api in PHP, all tests on postman have passed, but when i'm trying to integrate it with my ReactJS api, ONLY on POST route to login, it is sending me a CORS error Cross-Origin Request Blocked: The Same Origin Policy…
-1
votes
1 answer

Slim 3 double output using own view file

In spite that I am very new to the Slim 3 framework I'm using it for a small project (API) and it works fine except for the double output that I'm getting back and it's making me crazy! I'm suspecting that htaccess is calling the index.php file…
1 2 3
27
28