Developing software in the Real World

Slim4-empty: minimal Slim 4 starting point

To simplify creating a new Slim 4 project, I've created slim4-empty which does this for me. To use it:

and you're done! The my-new-project directory is created and contains Slim 4 along with a minimally viable public/index.php to get you going. You can then run it with the PHP built-in server:

And navigate to https://localhost:8888 to view "Hello World" in your browser. What does it contain? Slim4-empty provides no structure to your project… continue reading.

Receiving input into a Slim 4 application

A Slim 4 (and Slim 3) application receives data from three places: Any query parameters on the URL (the key-value pairs after the ?) The HTTP message's body (usually for POST and PUT) messages Parameters in the URL (such as the 3 in Within the application, these are available within the PSR-7 Request object. Let's start with a simple Slim 4 application. Firstly we require the Slim framework and a PSR-7 implementation:

Now… continue reading.

A first look at Slim 4

With Slim 4 we have continued the tradition of allowing you to use the framework in the way that best fits you and your project. You can create a Slim application entirely in a single file suitable for prototyping through to a few files for a simple web hook or serverless action all the way to fully-decoupled application suitable for the enterprise. From my point of view, the big changes with Slim 4 are: Support… continue reading.

Slim 4 Cyclomatic Complexity

There's not much wrong with Slim 3; lots of people are using it very successfully producing APIs and websites of all kinds. For Slim 4 the main goals have been to support PSR-15, make it easier to use your own PSR-7 implementation, improve error handling and remove assumptions that look magical if you don't know they are there. The latter one is the most important to me, personally! Secondarily, Pierre has concentrated on making Slim's… continue reading.