Slim 4 is an open source PHP micro framework that helps writing web applications and APIs.
Questions tagged [slim-4]
93 questions
0
votes
1 answer
slim create response with guzzle streamFor content
I have an issue when building a slim (slim 4) response with a streamed content (a huge xlsx file content).
$fileHandler = \fopen(getenv('SHARED_FILES_PATH') . $filename, 'r');
if (!$fileHandler) {
throw new \Exception('Unable to open file ' .…

chaillouvincent
- 197
- 1
- 3
- 17
0
votes
0 answers
Slim 4 Application throwing a HttpMethodNotAllowed on file upload
I created an application using php slim 4. When I submit a form with a file attached to it, It works perfectly on my local machine but when I hosted it on the server, it also works but only a certain conditions.
If the filename has some certain…

Daniel Isikaku
- 1
- 1
0
votes
1 answer
Slim v4, addErrorMiddleware doesn't seem to do anything
So I just started using the slim PHP Framework and I'm a bit confused.
As stated in the documentation:
https://www.slimframework.com/docs/v4/middleware/error-handling.html#adding-custom-error-handlers
This should add some sort of Error Handling.
So…

Silvan Kisseleff
- 258
- 2
- 11
0
votes
2 answers
Angular 2 & Slim PHP Framework: How to properly escape a string for use in a GET request
Environment
I have a frontend built using Angular2 which communicates with an API built using Slim PHP Framework v4.
Within the Angular frontend, a user can enter text into a form and submit it, then receive a response from the API.
The Angular…

Muckee
- 474
- 1
- 8
- 26
0
votes
1 answer
I'm transitioning my API from slim-3 to slim-4 and I'm struggling to figure out how to add JWT to the middleware
I'm using composer to install the slim-skeleton. Those built in routes work as expected. I understand how to add in my previous routes and database connections, but I've been struggling on how to add in any JWT library. I've searched and searched…

tafn3t
- 43
- 5
0
votes
1 answer
Can't access formData in backend Slim 4
I'm trying to upload files using vue.js, slim 4 and vuetify and I can't access the formData in my backend.
This is my vuetify form:

Erick Hernandez
- 25
- 6
0
votes
1 answer
SLIM PUT-Request CORS Header missing
I've tried to set up a Angular App with SLIM Framework v4 Backend; Angular is running local, while Slim is on a Deploy Server. So CORS Setup is needed and I did like given in the documentation:
$app->options('/{routes:.+}', function ($request,…

Galileon
- 26
- 5
0
votes
1 answer
Uncaught Error: Call to undefined method App\App::run() in Slim-4 php and php-di
While working with Slim and PHP-DI, got a warning saying
Uncaught Error: Call to undefined method App\App::run()
The code is as follows:
require __DIR__ . "/../vendor/autoload.php";
$app = new \DI\Bridge\Slim\Bridge;
$app->run();

Gursewak Singh
- 642
- 1
- 7
- 20
0
votes
1 answer
Slim 4 - Uncaught TypeError: Argument 1 passed to {closure}() must be an instance of RouterCollectorProxy
I'm following the guide of slim 4 to create routes group but I get this error when I try to test the deployed heroku app:
PHP Fatal error: Uncaught TypeError: Argument 1 passed to {closure}() must be an instance of RouterCollectorProxy, instance of…

miko
- 109
- 2
- 9
0
votes
1 answer
slim/twig-view - TwigExtension template functions not indetified and working
I'm following the steps described here to use twig-view within Slim https://github.com/slimphp/Twig-View/tree/3.1.0#usage but I'm getting the following error on my screen when I try to use anyof the template functions used in TwigExtension
Fatal…

ltdev
- 4,037
- 20
- 69
- 129
0
votes
0 answers
Slim 4 - Registering and Accessing Routes
I have just created slim 4 project using "composer create-project slim\slim-skeleton appdb". I have a routes.php as

Julius Peter Odeke
- 55
- 7
0
votes
1 answer
Redirect from one POST route to another POST route from a class method handler in Slim Framework V4
I have two POST routes /test and /test_new. The objective is to redirect all incoming requests from /test_new to /test along with the body contents. Hence The following code aims to use a named route for redirection
$app->post('/test', function…

Biswajit
- 149
- 9
0
votes
1 answer
Doctrine annotations for migrations and ORM
I'm trying to setup a project using Slim and Doctrine. My problem is with the annotations.
If I try to run diff from migrations, it requires the annotations from my entities to be like this:
But, if I try to persist my objects in PHP ORM, it…

Gustavo Carletto
- 43
- 7
0
votes
0 answers
One PHP class can be found, but the other cannot
I am using the Slim 4 framework and trying to get the routing working, but for the life of me I cannot figure out why my controller file cannot be found. I'm used to laravel taking care of all these things for me, but I wanted to try slim for my…

jelly5798
- 349
- 2
- 9
0
votes
0 answers
Can't POST or PUT with Slim framework 4 - Works fine in v3
I'm trying to learn slim framework and I ran into a, in my eyes, strange issue. In Slim framework 3 it works fine.
I've already done a lot of research before posting this question but to be honest it get even more complicated with all the answers I…

Sonia
- 195
- 1
- 3
- 12