← Back to context

Comment by mjrpes

6 days ago

What do you think of Slim Framework as far as best practices for modern PHP in a micro framework (which is similar to OP's Dumbo)? Are there any other micro frameworks you recommend?

https://www.slimframework.com/

At the risk of being piled on by fans of Slim (see fans of Laravel), I don't use slim frameworks.

For large projects when you get down to it, slim frameworks are simply frameworks where you have to add in components yourself, vs shipping with sane defaults.

Symfony comes with Doctrine, Twig, etc, but you can choose not to use them or even include them.

With slim frameworks if they are built correctly they will have hooks to add these components but you have to choose them and import them and set them up.

I have not worked on a small project in years, and have not bothered looking at slim frameworks in as much time, so my knowledge might be out of date ... but a quick glance through Slim's documentation tells me I'm still fairly close.

  • I'll add on to this too, as someone who largely agrees!

    I work for a company that has several mid-sized PHP projects. Some started life back with early PHP5 - eg 5.1.

    The biggest reason I don't like slim frameworks is that they make every project unique.

    Projects that start small rarely stay small, and if every project gets to pick it's own router, it's own method of doing CLI commands, it's own ORM, it's own messaging/queue stack, etc - then well intentioned decisions create a ton of variety in projects over time and it makes it very hard for people to jump from project to project. It also makes upgrades a mammoth task.

    We tested Slim, Laravel & Symfony and settled on Symfony.

    We found huge advantages in using a framework that can be installed piece-by-piece as you need it, but where the pieces are the same every time & consistently designed, and where the whole thing is designed to be upgraded in one go.

    Going with Symfony has been a genuine productivity improvement for us - every project follows the same basic structure, we try to follow Symfony best practices, we try to minimise tons of external dependencies. It makes maintenance much much easier, and makes something like 'hey, we really should be processing this async in the background' an easy step - just install symfony/messenger, rather than evaluating different options, etc.

    edit: we didn't go for Laravel because Eloquent really didn't compare well to Doctrine, and the amount of hard to debug 'magic' was much worse for us than Symfony.