DEV Community

Cover image for Decision Time: PHP Framework Dilemma
SyntaxSeed (Sherri W)
SyntaxSeed (Sherri W)

Posted on • Updated on • Originally published at blog.syntaxseed.com

Decision Time: PHP Framework Dilemma

My freelance business has grown, and reached a critical decision point for my future development. I've been puzzling over this for a while - why not puzzle it out in public!?

I need to pick a PHP framework. Or maybe not pick one. But my dilemma is kind of unusual. I'd love the opinions of other experienced PHP devs! But hear me out, my situation is a bit unique.

Unhelpful Metrics

Extensive research has given me endless comparisons of Laravel vs Symfony & others, using completely useless (to me) metrics like:

  • Number of GitHub stars.
  • Google search popularity.
  • Job postings.
  • Number of StackOverflow questions.
  • Millisecond differences in speed.
  • Etc.

These comparisons aren't helpful. Let me explain why.

My Situation

I build websites & web applications for small to medium sized businesses. Most start as a basic website with a contact form, Google Map, and that's it. Many never grow past this. Some eventually add custom dynamic elements. Say a work-order status page. A searchable directory, etc. A few have grown bigger.

But, and this is key... I also provide hosting, so ongoing maintenance is on me. I don't deliver a project & wash my hands of it. I make future text changes, fix bugs, add things & keep it running - for sometimes many, many years. My oldest PHP project in production is over 10 years old!

Over time I will end up with DOZENS of these projects to take care of.

I don't have the luxury of one, beautiful application to keep front-of-mind.

And so, stability over time is a key. Easy upgrades are key. This is why WordPress replaced my internal CMS for clients who fit that use-case: one-click upgrades baby! That's gold.

Until recently I was using a simple, custom MVC framework that I built. Most of my existing projects are on that. But it's over 8 years old, pre-Composer, and time for a new direction. To give that old workhorse some credit though- it has needed almost zero updates over that time (likely due to stagnating on PHP v 5.6).

I have a few months of experience & learning with Laravel, it's nice. But ongoing updates are a concern. Backward compatibility isn't a priority for Laravel. And it's overkill for 90% of what I do.

I've built a few things with SlimPHP.

I'm intrigued by Symfony because it starts as a micro-framework & grows with you. Awesome!

I'm also considering sticking a few stable Composer packages together for a light version of a 'framework' that will cover all but my few large projects. Maybe Slim is exactly that?

Maybe 90% of what I do doesn't need a framework at all.

It all boils down to not wanting to regret my choice 10 years from now. My youngest child starts school next year & when that happens I'll be throwing my efforts into my business full time. Between now & then I want my ducks in a row & to do the necessary learning.

TL;DR - My Priorities

  • PHP based.
  • Stability over time.
  • Well documented & clear upgrade process.
  • Grows with my needs over time.
  • Doesn't break backward compatibility on a whim.
  • Ok to have one option for small stuff and one for big projects.

Thoughts?

Do you have experience maintaining several framework-based projects over time? What do you use? Is it painful?

Am I crazy for thinking everything even needs a framework?

How does your company handle the time spent maintaining & upgrading a client's project? Do you bill them for the time? Offer a Support Licence with a monthly fee that covers this type of work? Bundle it in the hosting fee?

Thanks everyone!

--
Originally Published on Blog.SyntaxSeed.com

Oldest comments (79)

Collapse
 
ssmusoke profile image
Stephen Senkomago Musoke

I am have maintained a legacy Laravel based solution (5.5), looking to start a green field project with Laravel 6, had a Symfony 4.1 solution and lost on which framework to use for a side project that I have been putting off for too long.

My heart is with API Platform (based on Symfony), but Laravel currently seems to be doing all the right things with developer experiences simplifying usages.

You are not crazy to leverage frameworks, because the more years you work with tech, the less code you want to write (since you will need to test, maintain and evolve it), as you get slower and have more responsibilities

The maintenance fees approach vary:

  • Support hours for keeping the system running (monthly and/or annual)
  • Cost updates as part of evolution of the system with new features
  • Not hide it in hosting fees as that gets seen by outsiders - so better not have questions in that area (so its generally a pass through cost with markup to cover hosting management time)
Collapse
 
syntaxseed profile image
SyntaxSeed (Sherri W)

Oh I was never going to write what a framework does myself. Rather, just use a few stable packages for the small stuff.

I did the build my own framework thing 10 years ago. It's still in use. All this research is me moving away from the internal framework. :D

Great tips!

Collapse
 
bamboriz profile image
Boris B.

API Platform (based on Symfony) is the best thing that happened to me this year. I would be putting up a post with my experience on it soon 😎

Collapse
 
fulopattila122 profile image
Attila Fulop

Working with API platform on a real project was really painful for us. We got rid of it completely in the latest version of our api. (Still running on the previous version).

Thread Thread
 
ssmusoke profile image
Stephen Senkomago Musoke

What were the blockers that you faced? How did it not fulfil your needs? I am keen to learn as I keep an eye on it for a future API driven project

Collapse
 
malib profile image
Ali

Did you ever tried Yii2 PHP framework ?

Collapse
 
syntaxseed profile image
SyntaxSeed (Sherri W)

Nope, not yet!

Collapse
 
joehx profile image
joe-hx

You owe it to yourself to give Craft CMS a try, which is built on Yii2. Coming from WP experience Craft will make you feel like you can finally breathe. And when you get into extending it with custom modules or plugins, it's mostly been a joy for me. The only projects I haven't converted to it are either too small to deserve a framework or too specialized to use someone else's.

Thread Thread
 
crawlingcity profile image
crawlingcity

Finally some yii2 love.
We have an in-house CMS pretty much like craft, tailored for our needs which include: deploy using deployer.org, docker for local development and some configurations magic for SEO/routing - my point is, yii2 is really good, fast and reliable. Give it a try OP

Collapse
 
klauenboesch profile image
Christian • Edited

No matter what project, I would go with Symfony and Symfony only. Especially with Symfony4 (and Flex) you can put together the pieces you want and omit ones you don‘t need.

I think there is no better framework in terms of architecture and design than Symfony. I do not lile the stuff Laravel does (did?) with static methods and a lot of magic.

In terms of maintainability and co., you always go better when using a framework. I honestly don‘t want to write code handling HTTP requests/responses - somebody else will do it way better than myself.

Collapse
 
tomebuljevic profile image
Tomislav Buljević

I agree wholeheartedly. Seeing as I do have some experience with Symfony (3-4 years worth), I can say that it gives you a well-structured codebase, all the joys of MVC and minimal BC breaks. You're only limited by the PHP version on your server. Regarding the cost of maintaining the codebase, I'd go with a monthly fee.

Collapse
 
nemutaisama profile image
Andrey Ageev

I think there is no better framework in terms of architecture and design than Symfony.

Then you surely should try ZendExpressive )

Collapse
 
suckup_de profile image
Lars Moelleken

Maybe you can use some PSR standard components and use it in something like a non framework approach. So that you are not vendor logged-in into a special framework.
github.com/PatrickLouys/no-framewo...

Collapse
 
ryanwinchester profile image
Ryan Winchester

I've maintained many Laravel-based applications over the years from v3 to ~v5.5

Based on my experience and your priorities, I would recommend Symfony.

Collapse
 
opengeek profile image
Jason Coward

Is there something you didn't like about Slim? I'm a massive fan of this microframework because it is minimal and has a good history of sticking close to accepted community standards. Then again, it doesn't include much, so if you are looking for a framework with a lot of pre-built pieces to throw together, it would not be the right choice.

Slim 4 is on board with PSR-15 and seems like the right choice for a seemingly good DIY developer such as you have presented here with a brief description of your projects.

Collapse
 
iceorfiresite profile image
Ice or Fire

Laravel.... or feel the Python love and try Django

Collapse
 
dead_lugosi profile image
margaret ⚠️🌎🔥 staples

"I'm also considering sticking a few stable Composer packages together for a light version of a 'framework' that will cover all but my few large projects."

This. Have favorite packages for different things and use only as many as you need for a project. /2cents

Collapse
 
syntaxseed profile image
SyntaxSeed (Sherri W)

Yes! I also thought that if I favour Symfony components... I'm half way there if I ever need to jump to full Symfony.

Collapse
 
dominikzogg profile image
Dominik Zogg

Shameless advertisement, but if you like slim but you're prefer something smaller (Lines of Code) and less complex (Cyclomatic Complexity), please take a look at github.com/chubbyphp/chubbyphp-fra...

PS: Go for a microframework expressive, slim or mine (PSR7, PSR15 based). Not only are they easier to understand, but thanks their not event driven, easier to debug.

Collapse
 
billriess profile image
Bill Riess

I really don't think you can go wrong with Laravel. 6 just released and is a LTS version meaning you don't need to worry about support going away anytime soon. Laravel also has a great toolset for managing your site through forge or the soon to be released vapor.

While you may not need every feature it supports out the box, you do have some added comfort that it can support almost any type of project and grow with you.

Collapse
 
phillmac profile image
phillmac

learn.userfrosting.com/
demo.userfrosting.com/

Userfrosting's good if you need built in user & permission management as a starting point

Collapse
 
mischakr profile image
Mischa Kroon

Have you tried some cms systems that also work well as frameworks like processwire or silverstripe.

Especially proccesswire might be a good fit since they seem to really care about backwards compatibility and you write basic php code for most things.

Collapse
 
lukehmu profile image
lukehmu

Hey, I work at a small dev agency and we primarily switch between 2 PHP technologies depending on the requirements. These tend to boil down to how large the project is and how much editing the client will do.

We will use laravel for a bigger web application, where the client won't be doing much editing. Obviously laravel is not a one click upgrade but if you use pick a LTS version to build on (6 has just been released) then it'll be supported for a few years with security patches and bug fixes.

The other route we go down is Craft CMS. We use this when a great authoring experience is key and there's lots of client editing. Think if it as a pretty version of WordPress that is built on a stable PHP framework, Yii. This makes it easy to extend as your client requirements grow, it has a one click upgrade and is extremely developer focused. It also has the benefit of only needing to maintain one system, not a separate PHP application and a WordPress installation

Check it out! Hope this helps.

Collapse
 
visi27 profile image
Evis Bregu

Both Laravel and Symfony are awesome frameworks with their pros and cons.

Laravel is very easy to get started and has a lot of functionality ready for you.
This does not mean that Symfony is harder but it needs more work and initial configuration.

Having said that I would choose Symfony for 3 main reasons:

  1. Backwards compatibility
  2. Enforcing best practices
  3. Doctrine ORM

What I don't like in Laravel is the fact that you can access everything (container, request, session etc.) anywhere in the application code just by using Facades and helper functions. This will lead to poor and difficult to maintain code in my opinion.

In the end I would advise to study both frameworks. They have many similarities and you never know when that knowledge will come handy.

P.S.: To learn Symfony I highly recommend symfonycasts.com tutorials. Ryan Weaver is an awesome teacher and he is the lead for Symfony documentation.

Collapse
 
mshel profile image
MikhailShel

Doctrine is a huge + for Symfony.

Collapse
 
ivanjuras profile image
Ivan Juras

Why don't you use WordPress as a decoupled combo? It's perfect for small-mid sized businesses.

Collapse
 
syntaxseed profile image
SyntaxSeed (Sherri W)

I do use WP for projects that fit the CMS mould. And that's a large chunk of my customers. Though I have no interest in working in the WP ecosystem writing custom plugins and features, for reasons. ;)

So custom projects are on an MVC framework.