Jump to content

Opinon time - API-capable frameworks


maxxd

Recommended Posts

Hey y'all. I'm doing some research right now and wanted to see if anybody has personal experience or opinions they're willing to share. I'm not looking for anyone to try to tell me which is definitively the best framework. My company is looking to migrate our application to a remote RESTful API to support about a thousand (for now) installations across several continents. I've been asked to look into what we want to use to do that. The choices on the table right now are CodeIgniter 4, Lumen by Laravel, and Slim.

Personally I'm leaning toward CI4 at the moment as I like the updates they've made to the framework as a whole - it actually feels like a modern framework now, it's got fairly robust functionality without being overly opinionated, and it's zippy from what I've seen. However, it doesn't come with authorization out of the box, so that'll have to be home-grown. I'm leery of Lumen because... well, fair or not, it's a Laravel product and I have some qualms with Laravel - it's the overly opinionated thing, mostly. Slim I don't know terribly well (I played with it a bit a year or so ago) - it looks nice, but seems like it's pretty much just a router and we'd have to create all the CRUD functionality and whatnot all over again.

All of that being said, really nothing's off the table at the moment and I can see pros and cons for each of them. Which is why I'm asking here - any stories to share? Pain point, pleasant surprises, things you can't live without (or with)?

Thanks in advance!

Link to comment
Share on other sites

I've not used any of the listed options.  The couple API's I've worked on have just used Symfony since that's what I typically use for other applications.  It's worked fine for me for the most part.  There are various bundles dedicated to implementing REST API's that may be useful (ie, FOSRestBundle).

 

  • Like 1
Link to comment
Share on other sites

I agree with requinix.  Newbies really love the facades, but then when they start writing unit tests they are quickly sorry they did. 

In comparing the 2 frameworks:

Laravel is opinionated and comes with things like a user system.  Symfony isn't, but does have bundles from groups like "Friends of Symfony" aka FOS, who have a symbiotic relationship with the main Symfony project.  There's a large number of FOS bundles you can drop into your Symfony project like the FOS User Bundle and Rest Bundle which might be of specific value to your project.

Laravel has an Active Record ORM for database models called Eloquent, that includes a query builder and is solid.  Symfony does not provide an ORM, but again has a long relationship both with the Propel and Doctrine projects.  Doctrine provides a Data Mapper pattern implementation, which I greatly prefer to Active Record, and it also comes with "Repositories" and a connection manager that handles persistence and transactions in a superior way.  The sophistication of the behavior available in Doctrine is far more advanced than what Eloquent offers.

Routing and Controllers are comparable in each.

Laravel's template language Blade is ok.  Symfony's Twig is more advanced in its abilities to compose templates from partials and inheritance.  

Laravel comes with pretty much everything you need out of the box to develop most types of projects, and has a fair amount of "magic" that handles making everything work together.  It's an excellent project with a large community and documentation galore.  It's also very popular, and probably has more adoption than Symfony does, particularly in many parts of the US.

Symfony also has a large community, and out of that community not only did Laravel emerge, but also Composer, which was an essential dependency management tool that in my opinion saved PHP from obscurity as a web development platform.  

Having done large projects with both frameworks, I would still choose Symfony (with Doctrine and Twig), but really either one will work for you.  They are both dependency injection frameworks, and have a dependency injection container and ways to configure services based on class libraries, whether those be ones you get from FOS or other sources, or that you have built yourself.

Link to comment
Share on other sites

@requinix - I too hate the "magic" aspects of Laravel. I really don't think it should take hours to figure out where data is coming from...

@gizmola - Thank you for taking the time to write all that out! I'm planning on doing some more research this weekend and will definitely keep your post in mind as I do. Admittedly I like Twig and Doctrine myself, so I'm definitely gonna take some time going through those git repositories as well.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.