INTRO
If you are working as a PHP software developer, there is an extremely high chance that all of your application, you’re currently working on, using frameworks of any kind.
PHP community developers of all levels worship frameworks since there are big historical and practical reasons for that.
Historical reasons
Since early PHP versions, developers were disreputable because not everybody considered PHP as a programming language, similar like JavaScript couple of years ago. While strong type language existed decades ago, PHP continues to be soft type since now, only in version 7 basic types were introduced. There is also a matter of the fact that you can script in PHP without using a single object.
But that opened a space for frameworks to step in and introduce themselves as a tool or standard which will shape projects, give them right and order, introduce structure and rules.
And finally, they did. Frameworks are good examples of nice structures, using all available new features PHP offers with every version, enforcing some good practice, etc.
Practical reasons
The framework offers a lot of common problems already solved. They offer a nice ecosystem for other developers to contribute and plug their components. There is a lot of online resources for learning and stay updated about any particular framework. Also, what every framework community tries very hard, is to make setup and usage easy.
WHEN PHP FRAMEWORKS SUCKS
I recently had the opportunity to give a talk on a conference and one meetup about why PHP framework sometimes sucks. Sometimes things we see in framework tutorials does not seem to be very much aligned with some object-oriented standards we are striving to enforce, and with basic clean code guidelines. On the other hand, there is nothing wrong with using a framework, if you use it right.
This article is first "pilot" article in this series, to measure how much audience on dev.to are happy to learn about this subject in blog-series format. In every new blog in this series, we will go more in-depth about every specific topic I covered during my presentation.
I'm very excited to share this knowledge, as I saw many developers suffer from bonded-to-framework disease.
I won’t spend much time here on any particular framework discussion. This series will be just a guide how to unbind yourself from frameworks and use them as a tool, instead of being independent.
Here is the link to the presentation slides.
Top comments (4)
I have seen both sides, too much reliance on a framework and no framework. They both can be bad depending on how you use them. The really good frameworks, not just for PHP, give you ways to hook in plain objects into its system and give you the flexibility to do whatever you need. Though doing things in a good way is always up to the dev and framework or not can result in really bad code.
I agree with you 100%, and you will see in this series that I will try to imply exactly that methodologies to hook up to the framework, not hard-wire.
In PHP frameworks plays an important role, since they really brought some good practice to every developer. But than devs become framework religious :(
Hi, there :) thank you for your opinion. I read this article some time ago, and I believe it shares some points with this post, but however, I do not try to imply that the framework should not be used. Quite opposite, I believe frameworks have such a positive impact on the PHP community. I will only be pointing to the bad practices programmers applying while hiding behind the fact that "framework tutorial" say so.
I will publish soon next part of this series, I'm curious to see your opinion on next one (practical example).
Cheers!
I don't know if PHP frameworks suck. But your post title sucks for sure. 😆 I didn't read all for now, I will. But my first thoughts if that your are giving examples when frameworks are used the wrong way. Yes, everything suck when it is used the wrong way.