6 ms·
might as well ask this here: does anyone have any recommendations for minimalist PHP frameworks, in 2022? I have a hand-rolled PHP site that's been getting quit
by adamrezich 4y ago
might as well ask this here: does anyone have any recommendations for minimalist PHP frameworks, in 2022? I have a hand-rolled PHP site that's been getting quite a bit of traffic and it needs quite a bit of internal reworking to make things more performant and such. I'm looking at evaluating Fat-Free Framework as it seems to be more or less what I'm looking for, but I haven't seen any recent opinions anywhere about it (aside from top-ten lists, which is all you can find when you search google for such opinions).
all I need is routing, caching, possibly some light database abstraction, and possibly some light templating stuff (but PHP is a templating language, and that's how I'm currently using it). I don't want MVC or any of that, just the absolute basics.
- hanikesn 4y agosymfony flex
- conradfr 4y agoAnd https://symfony.com/doc/current/configuration/micro_kernel_trait.html https://symfony.com/doc/current/configuration/micro_kernel_t...
- bkanber 4y agoAnother option is Laravel Lumen
- n42 4y agoLumen is officially not recommended. If you think you need Lumen, just use Laravel and rip out the things you don’t need. It’s much easier to pare down these days than it was when Lumen was released
- ceejayoz 4y agoLumen is being deprecated due to PHP and Laravel performance improvements that make it largely irrelevant. https://lumen.laravel.com/docs/9.x https://lumen.laravel.com/docs/9.x > Note: In the years since releasing Lumen, PHP has made a variety of wonderful performance improvements. For this reason, along with the availability of Laravel Octane, we no longer recommend that you begin new projects with Lumen. Instead, we recommend always beginning new projects with Laravel.
- phphphphp 4y agoIf you don't want a framework, why do you want a framework? Picking an old, barely-used framework because it pitches itself as "fat-free" is a mistake: either use a good, modern, widely-used framework (like Laravel or Symfony) and benefit from a cohesive framework experience OR skip the framework altogether and grab best-in-class packages for each of the individual things you need and wire them together yourself. You could probably get all of what you need out of PHP League's packages: https://thephpleague.com/ https://thephpleague.com/
- adamrezich 4y agoI'm not looking at F3 because of how it pitches itself, I'm looking at it because I skimmed the docs and it looks like the closest thing to what I'm looking for. right now my whole website is hilariously one giant PHP file (CSS and Javascript both embedded, lol), with a giant switch branch on the after-the-domain part of $_SERVER['REQUEST_URI'] (there's only a few branches because the landing page is the main bulk of the site). the website was rapidly prototyped, and I hadn't used PHP since like 2008. I don't have any interest in overly-complex ways of doing things (using classes for everything, using the MVC pattern), but I do want slightly better organization. I had to monkey-patch in some rudimentary caching on the database-intensive landing page when we started getting lots of traffic, and anything that would make that easier as I add more functionality (that also should be cached) to the site would be great. oh, and I'm running the whole thing on IONOS shared hosting and for business reasons it's not really feasible to use anything else at the moment. so this is why I'm looking at evaluating F3 or any other similar "minimalist" frameworks—I don't want or need a super opinionated complex rejiggering of my existing code, but some small amount of better formal structure would be nice. also, I'm not using any other packages or libraries or anything, except for Stripe, which was incredibly easy to integrate.
- bornfreddy 4y agoJust an (unsolicited) opinion - MVC pattern if one of the few mainstays, and it's like that for a reason. It might (or might not) fit your use case, but it is hardly complex. Also any other dev looking at the code wil probably know it. Apart from that, I would skip framework if I were you. Web is littered with abandoned PHP frameworks which were all viable at some time. If it already works, just clean it up, refactor as needed and identify + resolve any performance bottlenecks.
- chipotle_coyote 4y agoFat-Free might be your best bet if you really want to go with a framework, but another possibility is using libraries that will do what you want rather than a framework, e.g.: Routing - FastRoute Light DB abstraction - if PDO alone can't cut it, maybe Doctrine DBAL (without the ORM) Templating - rolling your own is pretty easy if you feel you have the discipline not to stuff business logic in there Part of me appreciates how PHP is being driven forward by Laravel and friends; another part of me wonders if PHP has become a cargo cult version of Java to the point where many frameworks, and even libraries, are tremendously over-engineered.
- nobleach 4y agoI haven't used PHP in a lot of years. I just took over a team that uses it so I thought, "let's play with it a bit". After looking at Symfony (and not hating it) I thought, "this looks so much like Java+Perl (with some C++ thrown in) why not just write Java/Kotlin SpringBoot at this point??"
- wwweston 4y agoThese things stand out to me: (1) Dead-simple deployment story across a wide variety of needs. You want to throw your app's filetree in a directory on $10/mo hosting via SFTP? Easy peasy. You want turnkey autoscaling cloud deployments you don't have to build infra for? People will sell it to you. (2) Beginner/junior friendly culture. Really, everywhere along the learning curve. Both have long been PHP strengths. #2 was also a weakness for a long long time, that's how a lot of bad practices and blind-leading-the-blind happened. In the last 10 years that's been very much changed. Java has also changed, of course, and selling people easy deployment has become industry-wide bread and butter, so you're probably correct that some gaps have narrowed, but AFAICT they haven't gone away.
- nobleach 4y agoYes, with Java, the advent of the "fat-jar"/"uber-jar" deployments with an embedded server is far different than the massive deployable war to an application server stuff from yesteryear. And I can see that. PHP definitely allows one to "ladder up" a whole lot easier than some other languages. Once we get into these large "batteries included" frameworks like Symfony and to a little lesser extent Laravel, it almost seems like that simplicity disappears.
- AdrianB1 4y agoUsed to be Slim, but I haven't used it recently (2-3 years). Worth to take a look.
- jpoesen 4y agoHave you looked at Slim (PHP microframework)? --> https://www.slimframework.com/ https://www.slimframework.com/
- adamrezich 4y agoSlim is the other one I'm looking at. in a just world I would be able to type "slim vs fat free framework" into google and see at least some forum posts or something comparing and contrasting the two, but all I get instead is top-ten lists that mention both without really giving a good comparison.
- ryangittins 4y agoI've never heard of F3 so I can't compare and contrast, but Slim is definitely my go-to for projects like the one you describe. Just enough boilerplate to handle the basics, but not a ton of framework-specific quirks and conventions to learn.
- euph0ria 4y agoSlim is really nice. We've used it with great success in several production systems.
- gremlinsinc 4y agoCan I recommend you try something with laravel, just for fun? Build a small app using laravel + filamentphp (admin/backend): https://filamentphp.com/ https://filamentphp.com/ In one day or less you get an amazing backend system that's so easy to manage it drives me crazy how hard I had to work for the same functionality before. Filament kinda made me fall back in love w/ Laravel to be honest.
- Ayesh 4y agoF3 is pretty good, I still run it in a few applications. It surprisingly held well with PHP 8 migration as well. However, the reason why I don't use F3 anymore is because of the god-object model. You are pretty much carrying around the `Base` class everywhere, and you are golden as long as you stick with what's provided with F3. However, it's difficult to adapt to more modular applications that you mix and match template engines, routers, DBALs, and a DI containers. I can HIGHLY recommend Slim PHP. The version 3 is a little bit opinionated, and the 4.x is more modular. So pick your poison. F3 has a ton of functionality in a surprisingly small package. If F3 covers all of your requirements, go with F3. My grudge with it is that it's not as easy to decouple as Slim, which mostly stays away after it does it's thing.
- deleted 4y ago[deleted]
- unity1001 4y agoWordpress is a framework as of this point. Just put one up for your site. Maintaining a custom made website is not worth the hassle unless you have a very, very specific implementation that requires it.
- tehbeard 4y agoWordPress could more accurately be described as three goblins in a trenchcoat, masquerading as a "framework". If all that's needed is a brochure site or some light ecommerce, it's servicable. But the moment youre building an app, all that cms and legacy style code stuff becomes an anchor around your neck.
- gkedzierski 4y agoIt's pretty decent in headless mode, with something like Gatsby fetching data using its GraphQL API. (and surprisingly I had zero issues explaining to clients that now their site needs to be "built" first before they can see their changes live)
- unity1001 4y ago> WordPress could more accurately be described as three goblins in a trenchcoat, masquerading as a "framework". It runs practically 50% of the web now. From gigantic sites like Reuters to CNN. That sounds pretty legit as a framework to me. > But the moment youre building an app, all that cms and legacy style code stuff becomes an anchor around your neck. They don't. You never have to worry about that 'legacy' style code, cms, and actually practically anything. WP prioritizes backwards compatibility over anything else. So instead of jumping through the hoops of another framework's breaking updates, you can concentrate on your own app. Thinking of WP as 'a web framework as a service' is a much better way to describe it. Not even a 'framework'.
- ihateolives 4y agoHave a look at Framework X (https://framework-x.org https://framework-x.org). It's barebones, but provides routing and basic request/response handling to build your own stuff upon. It's based on ReactPHP so you can use it as standalone service or use it in shared hosting with FPM, whichever suits you.
- lordgroff 4y agoI went with Slim for a recent light project and then tore everything out and used the stdlib only, and then I realized I didn't even really need even a routing library in my case. It worked out great, but it's probably unusual. For a really small project, you likely just need a routing lib.
- lampshades 4y agoNot sure why you want a framework if the only thing you’re looking to make things more performant. Raw PHP is going to always be faster unless it’s a framework based on C modules. I’m not saying don’t do it and I know this isn’t answering your question but I’d really think about if a framework is what you’re looking for. Where are your bottle necks? I’m assuming this app is a monolith?
- RadixDLT 4y agobest barebones php framework is symfony.com they also have the best components that everybody uses