# Latest

**URL:** https://discourse.slimframework.com/latest.md?page=1

[Latest](https://discourse.slimframework.com/latest.md) · [Categories](https://discourse.slimframework.com/categories.md)

**Page:** 2

---

## [Looking for Best Practices for Structuring Slim 4 Apps with Middleware and Route Groups?](https://discourse.slimframework.com/t/looking-for-best-practices-for-structuring-slim-4-apps-with-middleware-and-route-groups/6144)

<div class="topic-metadata">

**Author:** [@marcelosalas](https://discourse.slimframework.com/u/marcelosalas)\
**Replies:** 1\
**Last updated:** [June 26, 2025, 5:45am UTC](https://discourse.slimframework.com/t/looking-for-best-practices-for-structuring-slim-4-apps-with-middleware-and-route-groups/6144 "2025-06-26T05:45:31Z")

</div>

Hi all, I am currently working on a mid-sized API using Slim 4 and wanted to get some input on how others are organizing their projects — especially regarding middleware and route groups. Right now, I have global middl…

---

## [Help Needed with Routing and Middleware in Slim 4](https://discourse.slimframework.com/t/help-needed-with-routing-and-middleware-in-slim-4/6103)

<div class="topic-metadata">

**Author:** [@mathew\_25](https://discourse.slimframework.com/u/mathew_25)\
**Replies:** 1\
**Last updated:** [June 1, 2025, 4:25pm UTC](https://discourse.slimframework.com/t/help-needed-with-routing-and-middleware-in-slim-4/6103 "2025-06-01T16:25:30Z")

</div>

Hi everyone, I’m currently learning Slim Framework (using version 4), and I’m really enjoying how lightweight and flexible it is. However, I’ve run into a bit of confusion when it comes to properly setting up routing an…

---

## [Slim4 withHeader cache wont overwrite?](https://discourse.slimframework.com/t/slim4-withheader-cache-wont-overwrite/3794)

<div class="topic-metadata">

**Author:** [@nadirian](https://discourse.slimframework.com/u/nadirian)\
**Replies:** 7\
**Last updated:** [May 13, 2025, 6:06pm UTC](https://discourse.slimframework.com/t/slim4-withheader-cache-wont-overwrite/3794 "2025-05-13T18:06:54Z")

</div>

Hi! I am running this code; $response = $response-\>withHeader(‘Cache-Control’, ‘public, max-age=86400’); $logger-\>info($response-\>getHeaderLine(‘Cache-Control’)); return $response; Which seem pretty basic. the log …

---

## [Slim4 : Why doesn't it work?](https://discourse.slimframework.com/t/slim4-why-doesnt-it-work/3209)

<div class="topic-metadata">

**Author:** [@sagarsarkar](https://discourse.slimframework.com/u/sagarsarkar)\
**Replies:** 4\
**Last updated:** [May 10, 2025, 1:55pm UTC](https://discourse.slimframework.com/t/slim4-why-doesnt-it-work/3209 "2025-05-10T13:55:13Z")

</div>

I went through the tutorial (http://www.slimframework.com/2019/04/25/slim-4.0.0-alpha-release.html) for V4 and following the steps to install and run a small application… but got stuck at the very 1st stage where it has …

---

## [Best way to load public assets in Slim 3 with different route configuration](https://discourse.slimframework.com/t/best-way-to-load-public-assets-in-slim-3-with-different-route-configuration/575)

<div class="topic-metadata">

**Author:** [@nollyj](https://discourse.slimframework.com/u/nollyj)\
**Replies:** 7\
**Last updated:** [May 5, 2025, 11:07pm UTC](https://discourse.slimframework.com/t/best-way-to-load-public-assets-in-slim-3-with-different-route-configuration/575 "2025-05-05T23:07:32Z")

</div>

I want to know how best to load my asset files with different route configuration. Example. With this route $app-\>map(\['POST', 'GET'\], '/dashboard','AuthController:signIn') - my assets loads very well but on anothe…

---

## [Need help for middleware orchestration Twig, Cas, sessionMiddleware](https://discourse.slimframework.com/t/need-help-for-middleware-orchestration-twig-cas-sessionmiddleware/6119)

<div class="topic-metadata">

**Author:** [@mixman68](https://discourse.slimframework.com/u/mixman68)\
**Replies:** 1\
**Last updated:** [May 5, 2025, 10:12pm UTC](https://discourse.slimframework.com/t/need-help-for-middleware-orchestration-twig-cas-sessionmiddleware/6119 "2025-05-05T22:12:10Z")

</div>

Hello, I have some difficulties to set elements in correct order for these elements. If I do that : $app-\>add(TwigMiddleware::class); the session is not reset but base\_path() is empty And if I do this : $app-\>add(T…

---

## [Generate relative-path URLs with Slim Router](https://discourse.slimframework.com/t/generate-relative-path-urls-with-slim-router/6098)

<div class="topic-metadata">

**Author:** [@Pictor13](https://discourse.slimframework.com/u/Pictor13)\
**Replies:** 5\
**Last updated:** [April 30, 2025, 9:42am UTC](https://discourse.slimframework.com/t/generate-relative-path-urls-with-slim-router/6098 "2025-04-30T09:42:05Z")

</div>

The Slim Router (same as FastRoute?) seems to support routes only with leading slash (e.g. /home). This is fine when the app is directly accessible at a domain (e.g. http://localhost/home, https://mysite.com/home) but i…

---

## [Slim Framework 4 with php 8.1 and IIS Server comunication](https://discourse.slimframework.com/t/slim-framework-4-with-php-8-1-and-iis-server-comunication/6068)

<div class="topic-metadata">

**Author:** [@PeterW](https://discourse.slimframework.com/u/PeterW)\
**Replies:** 9\
**Last updated:** [April 23, 2025, 1:26pm UTC](https://discourse.slimframework.com/t/slim-framework-4-with-php-8-1-and-iis-server-comunication/6068 "2025-04-23T13:26:07Z")

</div>

I have a problem with the operation of the website. I installed slim framework v.4 I have php v.8.1 and the server IIS Slim 4 Documentation - Slim Framework I used this code to try if the project would start and unfortu…

---

## [I can't download Slim](https://discourse.slimframework.com/t/i-cant-download-slim/6085)

<div class="topic-metadata">

**Author:** [@LonchakovAV](https://discourse.slimframework.com/u/LonchakovAV)\
**Replies:** 2\
**Last updated:** [April 23, 2025, 7:26am UTC](https://discourse.slimframework.com/t/i-cant-download-slim/6085 "2025-04-23T07:26:49Z")

</div>

I don’t know what composer is, and I just want to download Slim to study it on my Apache. I can’t find a download link on your site :frowning:

---

## [Slim Install Ubuntu 25.04 PHP 8.4.5](https://discourse.slimframework.com/t/slim-install-ubuntu-25-04-php-8-4-5/6088)

<div class="topic-metadata">

**Author:** [@orellanal](https://discourse.slimframework.com/u/orellanal)\
**Replies:** 4\
**Last updated:** [April 22, 2025, 2:45pm UTC](https://discourse.slimframework.com/t/slim-install-ubuntu-25-04-php-8-4-5/6088 "2025-04-22T14:45:46Z")

</div>

Undefined Symbol pdo\_dbh\_ce I try to install Slim in my upgraded Ubuntu install. I got the error pdo\_dbh\_ce when I try to load the server. php -S localhost:8080 -t public Additional error information /usr/lib/php/…

---

## [An example from the main page does not work](https://discourse.slimframework.com/t/an-example-from-the-main-page-does-not-work/6086)

<div class="topic-metadata">

**Author:** [@LonchakovAV](https://discourse.slimframework.com/u/LonchakovAV)\
**Replies:** 1\
**Last updated:** [March 21, 2025, 4:01pm UTC](https://discourse.slimframework.com/t/an-example-from-the-main-page-does-not-work/6086 "2025-03-21T16:01:53Z")

</div>

I created an empty PHP project in NetBeans. I inserted an example of code from the main page. Does not work. Your project is not very friendly for beginners :frowning: Warning : require(C:\\DevTools\\Projects\\Test\\html\\Te…

---

## [Problems with monolog and slim 4](https://discourse.slimframework.com/t/problems-with-monolog-and-slim-4/6063)

<div class="topic-metadata">

**Author:** [@DimionIp](https://discourse.slimframework.com/u/DimionIp)\
**Replies:** 5\
**Last updated:** [March 10, 2025, 1:41pm UTC](https://discourse.slimframework.com/t/problems-with-monolog-and-slim-4/6063 "2025-03-10T13:41:02Z")

</div>

I am installing Monolog in Slim 4, but it is not working correctly and throws errors. Here is the trace: Uncaught TypeError: {closure:/home/e24/www/test.com/orders/index.php:228}(): Argument #1 ($request) must be of typ…

---

## [Best Way to Optimize Slim Framework for a Download Page?](https://discourse.slimframework.com/t/best-way-to-optimize-slim-framework-for-a-download-page/6058)

<div class="topic-metadata">

**Author:** [@john1](https://discourse.slimframework.com/u/john1)\
**Replies:** 1\
**Last updated:** [March 6, 2025, 12:39pm UTC](https://discourse.slimframework.com/t/best-way-to-optimize-slim-framework-for-a-download-page/6058 "2025-03-06T12:39:09Z")

</div>

:speech\_balloon: I run a site where I provide downloadable content, and I want to optimize my Slim Framework setup for better performance. Since Slim is lightweight, what are the best practices for handling multiple file…

---

## [Integrate both juliangut/slim-routing and php-di/slim-bridge](https://discourse.slimframework.com/t/integrate-both-juliangut-slim-routing-and-php-di-slim-bridge/6049)

<div class="topic-metadata">

**Author:** [@azurams](https://discourse.slimframework.com/u/azurams)\
**Replies:** 5\
**Last updated:** [February 26, 2025, 10:29am UTC](https://discourse.slimframework.com/t/integrate-both-juliangut-slim-routing-and-php-di-slim-bridge/6049 "2025-02-26T10:29:25Z")

</div>

In my application I already use php-di/slim-bridge, where the app is created with $app = \\DI\\Bridge\\Slim\\Bridge::create($container); I would like to use also juliangut/slim-routing library to have php attributes define…

---

## [Routing middleware really doesn't want to work \[Solved\]](https://discourse.slimframework.com/t/routing-middleware-really-doesnt-want-to-work-solved/6052)

<div class="topic-metadata">

**Author:** [@Jeremk](https://discourse.slimframework.com/u/Jeremk)\
**Replies:** 0\
**Last updated:** [February 18, 2025, 12:23am UTC](https://discourse.slimframework.com/t/routing-middleware-really-doesnt-want-to-work-solved/6052 "2025-02-18T00:23:14Z")

</div>

slim/slim: ^4.14 slim/psr7: ^1.7 I do things like this : $app-\>group(BASE\_URI . "/art", function($app) use($connexionBD): void { $repositoryArtefacts = new RepositoryArtefact($connexionBD); $controllerArt…

---

## [How to utilize Slim-Http Decorators in Slim 4](https://discourse.slimframework.com/t/how-to-utilize-slim-http-decorators-in-slim-4/5511)

<div class="topic-metadata">

**Author:** [@chad.skeeters](https://discourse.slimframework.com/u/chad.skeeters)\
**Replies:** 3\
**Last updated:** [February 17, 2025, 10:55pm UTC](https://discourse.slimframework.com/t/how-to-utilize-slim-http-decorators-in-slim-4/5511 "2025-02-17T22:55:30Z")

</div>

How do you utilize Slim-Http Decorators in Slim 4? I can’t figure it out despite finding information at the following URLs. Documentation? · Issue #90 · slimphp/Slim-Http · GitHub Slim-4.5 skeleton app with Slim-http …

---

## [Slim4 route with same folder name not working](https://discourse.slimframework.com/t/slim4-route-with-same-folder-name-not-working/6044)

<div class="topic-metadata">

**Author:** [@dandoonian](https://discourse.slimframework.com/u/dandoonian)\
**Replies:** 1\
**Last updated:** [February 12, 2025, 6:26pm UTC](https://discourse.slimframework.com/t/slim4-route-with-same-folder-name-not-working/6044 "2025-02-12T18:26:23Z")

</div>

i had a project written in slim3, that i am upgrading to slim4. i have a route group named app, in which i have tens of routes. GET app/testserver GET app/testdata POST app/senddata … all these routes are not worki…

---

## [POST method only returns null (slim3)](https://discourse.slimframework.com/t/post-method-only-returns-null-slim3/6040)

<div class="topic-metadata">

**Author:** [@lcbrasil](https://discourse.slimframework.com/u/lcbrasil)\
**Replies:** 0\
**Last updated:** [January 30, 2025, 3:42pm UTC](https://discourse.slimframework.com/t/post-method-only-returns-null-slim3/6040 "2025-01-30T15:42:09Z")

</div>

I appreciate if someone could help GET method works fine but POST method don’t. I used slim 3 and slim skeleton, the api is on my web page (Cpanel I´m not use localhost) I have in src/middleware.php the following: $…

---

## [How to validate files in request in SlimPHP?](https://discourse.slimframework.com/t/how-to-validate-files-in-request-in-slimphp/6037)

<div class="topic-metadata">

**Author:** [@Bezlepkin](https://discourse.slimframework.com/u/Bezlepkin)\
**Replies:** 1\
**Last updated:** [January 29, 2025, 7:19pm UTC](https://discourse.slimframework.com/t/how-to-validate-files-in-request-in-slimphp/6037 "2025-01-29T19:19:26Z")

</div>

Hi there! How to validate files in request in SlimPHP? Who uses what libraries?

---

## [How to Structure Middleware in Slim Framework for Clean Code:?](https://discourse.slimframework.com/t/how-to-structure-middleware-in-slim-framework-for-clean-code/6036)

<div class="topic-metadata">

**Author:** [@marcelosalas](https://discourse.slimframework.com/u/marcelosalas)\
**Replies:** 1\
**Last updated:** [January 26, 2025, 11:50am UTC](https://discourse.slimframework.com/t/how-to-structure-middleware-in-slim-framework-for-clean-code/6036 "2025-01-26T11:50:09Z")

</div>

Hi everyone, I have been working with Slim Framework for a while and I love its simplicity and flexibility. However…, as my project grows; I am finding my middleware logic becoming a bit messy and hard to maintain. Her…

---

## [The problem with redirect of the Slim4](https://discourse.slimframework.com/t/the-problem-with-redirect-of-the-slim4/6031)

<div class="topic-metadata">

**Author:** [@Lucass.a](https://discourse.slimframework.com/u/Lucass.a)\
**Replies:** 2\
**Last updated:** [January 13, 2025, 10:32am UTC](https://discourse.slimframework.com/t/the-problem-with-redirect-of-the-slim4/6031 "2025-01-13T10:32:43Z")

</div>

It’s been a while since I started my study of slim4, and I’m having a lot of difficulty understanding why it doesn’t redirect the route when a message is displayed on the screen. If anyone could explain it to me I would…

---

## [When is slim 5 planned to be alfa pre-released?](https://discourse.slimframework.com/t/when-is-slim-5-planned-to-be-alfa-pre-released/6017)

<div class="topic-metadata">

**Author:** [@alexber220](https://discourse.slimframework.com/u/alexber220)\
**Replies:** 3\
**Last updated:** [December 21, 2024, 5:57am UTC](https://discourse.slimframework.com/t/when-is-slim-5-planned-to-be-alfa-pre-released/6017 "2024-12-21T05:57:31Z")

</div>

what prevents you from accepting the pull request from odan?

---

## [404 and CustomErrorHandler](https://discourse.slimframework.com/t/404-and-customerrorhandler/6014)

<div class="topic-metadata">

**Author:** [@EgorKa](https://discourse.slimframework.com/u/EgorKa)\
**Replies:** 1\
**Last updated:** [December 10, 2024, 6:47pm UTC](https://discourse.slimframework.com/t/404-and-customerrorhandler/6014 "2024-12-10T18:47:01Z")

</div>

I am registering a custom error handler: $errorMiddleware = $app-\>addErrorMiddleware(false, false, false); $errorHandler = $errorMiddleware-\>getDefaultErrorHandler(); $errorHandler-\>registerErrorRenderer('text/html', M…

---

## [Standard Logging](https://discourse.slimframework.com/t/standard-logging/6013)

<div class="topic-metadata">

**Author:** [@cajund](https://discourse.slimframework.com/u/cajund)\
**Replies:** 2\
**Last updated:** [December 8, 2024, 8:03pm UTC](https://discourse.slimframework.com/t/standard-logging/6013 "2024-12-08T20:03:35Z")

</div>

Hi Folks, In your documentation for v.4, there’s no mention of logging. We’ve been trying to set things up, but need to log debugging information out to a file (or anywhere, really). But there are no examples anywhere. …

---

## [Invoke 404 Not Found Handler](https://discourse.slimframework.com/t/invoke-404-not-found-handler/3712)

<div class="topic-metadata">

**Author:** [@brainstorm](https://discourse.slimframework.com/u/brainstorm)\
**Replies:** 4\
**Last updated:** [November 30, 2024, 4:31pm UTC](https://discourse.slimframework.com/t/invoke-404-not-found-handler/3712 "2024-11-30T16:31:28Z")

</div>

Hello, In slim v4, How can I invoke a 404 Not Found Exception?

---

## [Use of ${id} in routing](https://discourse.slimframework.com/t/use-of-id-in-routing/6007)

<div class="topic-metadata">

**Author:** [@bnoeafk](https://discourse.slimframework.com/u/bnoeafk)\
**Replies:** 1\
**Last updated:** [November 27, 2024, 7:43am UTC](https://discourse.slimframework.com/t/use-of-id-in-routing/6007 "2024-11-27T07:43:05Z")

</div>

New here - new to Slim, so please be gentle! I’m going through the documentation and so far, all is good. However, whenever I try to use an “id” in a route, I always seem to get a HTTP/404 error. //$app-\>addRoutingMidd…

---

## [How to call Service from legacy code?](https://discourse.slimframework.com/t/how-to-call-service-from-legacy-code/6002)

<div class="topic-metadata">

**Author:** [@edm](https://discourse.slimframework.com/u/edm)\
**Replies:** 2\
**Last updated:** [November 3, 2024, 7:22pm UTC](https://discourse.slimframework.com/t/how-to-call-service-from-legacy-code/6002 "2024-11-03T19:22:28Z")

</div>

I used some parts of the “Slim 4 eBook Vol. 1” (Actions, Services, Repositories, Factory), that works well (PHP 7.4), e.g. routes.php: \<?php use Psr\\Http\\Message\\ResponseInterface as Response; use Psr\\Http\\Message\\Serv…

---

## [Best validation library for Slim](https://discourse.slimframework.com/t/best-validation-library-for-slim/5987)

<div class="topic-metadata">

**Author:** [@Nelson777](https://discourse.slimframework.com/u/Nelson777)\
**Replies:** 1\
**Last updated:** [September 30, 2024, 8:08am UTC](https://discourse.slimframework.com/t/best-validation-library-for-slim/5987 "2024-09-30T08:08:34Z")

</div>

Hello, I have developed a new library for the Slim Framework that makes request body validation more efficient and intuitive. The library aims to simplify the process of verifying data received in API endpoints, ensuring…

---

## [How do I add a custom Doctrine data type to SlimPHP Framwork?](https://discourse.slimframework.com/t/how-do-i-add-a-custom-doctrine-data-type-to-slimphp-framwork/5935)

<div class="topic-metadata">

**Author:** [@Bezlepkin](https://discourse.slimframework.com/u/Bezlepkin)\
**Replies:** 5\
**Last updated:** [September 30, 2024, 6:59am UTC](https://discourse.slimframework.com/t/how-do-i-add-a-custom-doctrine-data-type-to-slimphp-framwork/5935 "2024-09-30T06:59:59Z")

</div>

I need to add tinyint type to Doctrine. Many examples for Symfony but no examples for SlimPHP…

---

## [Seeking Project Starter for Slim 4 with Firebase/JWT and JimTools/JWT-Auth Integration](https://discourse.slimframework.com/t/seeking-project-starter-for-slim-4-with-firebase-jwt-and-jimtools-jwt-auth-integration/5994)

<div class="topic-metadata">

**Author:** [@viniribeirossa](https://discourse.slimframework.com/u/viniribeirossa)\
**Replies:** 0\
**Last updated:** [September 28, 2024, 1:19am UTC](https://discourse.slimframework.com/t/seeking-project-starter-for-slim-4-with-firebase-jwt-and-jimtools-jwt-auth-integration/5994 "2024-09-28T01:19:44Z")

</div>

Hi everyone. I just started using Slim 4 and I’m learning/developing an independent music website. I wanted to use the firebase/jwt and jimtools/jwt-auth libraries to allow users to log in and release a token for the Aut…

[Previous page](https://discourse.slimframework.com/latest.md)

[Next page](https://discourse.slimframework.com/latest.md?page=2)
