Should I Ever Use PHP Framework?
(tl;dr; available on the bottom)
You know, this Framework vs NO-Framework is like
- the old Internet Explorer vs Netscape
- Chrome vs Firefox
- Android vs iPhone
- Apple vs Microsoft
- Touchpad vs Mouse
- Optical Mouse vs Laser Mouse vs mechanical mouse (yeah… throw the topic in a game forum, then a war shall arise between the tribes)
- Frameworks vs NO-Framework
- OOP vs Functional
When not to use?
Obviously when you need to work alone and never expecting anyone else to work on your code, and also you are not aiming to a have a huge code base. In this case yes, you should never use a framework. Especially when you would like to prove that
echo 'hello world' is much faster without framework. Then you are DAMN RIGHT.
Also you should not use them, when you do not see the potential of it.
Turning the tide
However in this case it is really advised to turn to some guys who use it.
It is the most pathetic action that you could do is to listen to the haters, or ask them for advise.
What do you expect?
It is like expecting a Microsoft fan to say: “Well yes, Apple is more developer friendly than Microsoft will ever be.”
Not going to HAPPEN.
Be Open Minded
You know if everyone would done the same (always listening to the haters) we would still think that Earth is flat, women and… No!
If you want to get to know someone or something you need to ASK people representing that thing / group. Nothing is more pathetic then asking those who has negative feeling toward something while a big bunch of people are positive toward the same thing. I have a friend from middle-east, who is the most kind person I have ever met. If I was listening to the Media or some racists I would never ever meet him.
Self-Testing The Theory: “Ask them instead of the opposite faction.”
All you need is a simple question to run this test (no fancy phpunit or anything needed for this):
Would you be happy, if before I meet you, I go to RANDOM strangers (or right to a person you dislike you) and ask them about you?
So, if that question EVER pops into your head, that “what the heck is a Framework, should I use it?” then DO NOT POST IT ON Facebook as a question, do your own research. The only thing is going to happen to see some random dudes popping up telling that how right you are and yes you should never use them.
Always ask THEM and not the opposite faction.
When To Use Framework
When you are ready. It is a lot ahead of you: Diving into OOP, versioning, teamwork, etc.
As soon as you realise that Framework is there to help you and your team to have a FRAME for your work, that anybody can follow, you are good to go. :)
By doing so you can always recruit someone experienced with that framework and reduce the “joining on-board latency” and that person within a week can get to work. Comparing to the old: 1-2 month of “learning how you and your team thinks”.
Beside that, you (possibly) have a good documentation for that specific framework.
Which Framework To Go With
Whichever you want to go with. Really. It is that simple. I use Laravel as PHP Framework. I have a friend who still use CodeIgniter. He is not a bad guy because of that.
It is time to bond with a Framework. While you are on the road to get to know it you will be screaming many times: “WHY THE HECK THEY DID IT THIS WAY? THIS IS…. AAHHH FCKIT” The answer is and always will be: beacuse they can. :)
Do not forget: it is a frame for your work.
You could also create your own framework with your own rules, but god, please make a proper documentation if you ever expect anyone else working within it.
Yes I have been there, questioning the importance of Frameworks and saying how my functional code is better. Yes they can be better. I am still writing bash scripts and also small php scripts without using a framework.
However for work, I always try to use Framework. It also forces me to be consistent.
And yes, I was also thinking that Windows the only option for developing,
then ubuntu rocked my little world,
then came macOS and never looked back.
So please be open-minded, and ask the people representing the thing.
Keep in mind: You can always find people hating the “globe theory” and still think Earth is flat, therefore you can always find an opposite faction/tribe. You just need to decide: Are you ready to advance in life?
For the TL;DR; guys:
I am on both sides. :)
Really the most important with every tool and also with frameworks: “How am I going to utilize this framework?” - If you cannot answer it, you shouldn’t probably use Framework for that specific project.
But make sure that the answer is not coming from the lack of knowledge. If you have no knowledge, you cannot answer it. That is why you must research and listen to guys who use the stuff that you recently researched.
A guy who use something can give you hints on:
- When to use something
- When not to use something
But avoid the guy who just give you:
- When not to use something