Symfony is not the best PHP framework.

Ozan Akman
3 min readJan 29, 2023

--

Initially, I wanted to reply to a Reddit comment. It was already long enough to classify as a blog post. I hope you enjoy reading it. Let me know your thought on the comments.

Simply put, Symfony isn’t ideal for every situation.

Who am I?

I’m Ozan Akman, an experienced full-stack developer. I’ve worked with Laravel, Laminas (formerly Zend), and Symfony for many years. I’ve spent the last five years working for product companies. So, enterprise-level PHP frameworks were always on my radar. Due to my new employment, I shifted to backend development 1.5 years ago. Since that shift, Symfony is what I use. I love it. But must admit that I’ve seen some terrible Symfony apps. The developers who built a beautiful architecture that is enjoyable to work with are responsible for this “love it” experience, not the framework itself.

There are several requirements, but let’s try to figure it out.

What is Symfony best at?

  1. Overall development experience? When you get used to it and properly put it up, Symfony is pretty good.
  2. Full-stack development capabilities? Laravel is a better choice than Symfony.
  3. Learning curve? Symfony is not the best choice.
  4. Documentation? Symfony is effective but messy at the same time. It could be improved.
  5. Configuration? Symfony is a fantastic choice.
  6. Dealing with complexity? Symfony is one of my best experiences to solve complicated challenges with ease.

In the end, it all comes down to your goals.

Asking the right questions

Do you have limited resources and need to complete projects quickly? Laravel is a quick option. Do you prefer less magic and more stable ground? Symfony is a fantastic option. Will you be handling the client code? or designing an API only? Symfony is a good option. But it couldn’t even come closer to Laravel’s full-stack capabilities. Testing with both frameworks is a joy. Do you really need so much flexibility? Laminas is great and flexible but the DX isn’t the best. You deliver slower than other frameworks.

Every framework can scale. Each and every framework has excellent tooling. To be honest, working with nearly any advanced PHP framework is a joy. We have options, which is great.

My personal experience with frameworks

And again, I love Symfony. Two months ago, I started working on weekend projects, and Symfony was my first pick. After a month, I made the decision to try Laravel because I believed I could develop more quickly with it. That was true. I have a nice speed boost thanks to Laravel. You should know that I haven’t worked with Laravel in about five years. There were a few tweets and stories that I saw, but that was it. For many years, I lacked first-hand experience. I could change it so quickly. It was quite surprising. And the combination of Laravel and Inertia is simply amazing. Everything depends on the content and timing of your delivery.

I can also see why Laravel is hated, especially among experienced developers. It suggests bad practices. It has a feature called Facade that allows you to access objects from a container. I try to avoid using the Facade feature because it feels like it doesn’t make sense with all that magic. Of course, you are free to use dependency injection. But Laravel forces you to use its own methods, and you’re not as remotely free as Symfony’s flexibility. It lacked proper type hinting for so long. Unquestionably, there is room for improvement. Laravel isn’t the best, but it does the job for a full-stack project with just a solo programmer with limited time.

What’s the best PHP framework?

I intentionally stated that “it is not the best framework” for all of the mentioned frameworks above because none of them is the best. You need to make the most of them.

You need to focus on creating your system using design patterns, having a good architecture (e.g. hexagonal architecture), and around DDD principles.

The next time you choose one of those frameworks, you need to focus on delivery and timing. You need to decide what’s the best framework for you.

In the end, there is no such thing as “the best” framework. It all depends on you!

Want to read more articles like this one?

Follow me on Twitter and LinkedIn to know about my next article before everyone else.

Originally published at https://akman.hashnode.dev.

--

--