PHPMiNDS March: Slim 4: PHP's Microframework

Tonight at PHPMiNDS, we had Rob Allen speak about the Slim PHP Framework.

Having not touched much PHP development, it was interesting to see how things are done with other languages and frameworks.

Rob also shared that Slim is built as a microwebframework which is very flexible compared to larger, opinionated frameworks - both of which have their pros and cons. It's common to pick up a larger framework, but then throw away/ignore most of the functionality, but with a microwebframework you can combine different tools and build the solution you want.

One of my biggest takeaways from the talk is that Slim 4 is built on a number of PHP Standard Recommendations (PSR) which means that it's incredibly easy to use interchangeable libraries, such as pieces of middleware or Dependency Injection containers. I really like this idea of building upon standards and making it easy to work with the tools you want to!

After seeing the ease of getting up and running with it, I feel I need to get around to playing with it:

<?php
// use ...

$app = AppFactory::create();

$app->get('/hello/{name}', function (Request $request, Response $response, array $args) {
    $name = $args['name'];
    $response->getBody()->write("Hello, $name");
    return $response;
});

$app->run();

As an aside, I enjoyed Rob's comment about how Slim's code examples are one of the few that can be fit into a single slide yet be very readable.

Thanks Rob for coming to speak about it despite the Coronavirus concerns - we had a great turnout, and lots of good discussion!

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#phpminds #slim #php #events.

This post was filed under articles.

Has this content helped you? Please consider supporting me so I can continue to create content like this!

Related Posts

Other posts you may be interested in:

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.