Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Pure PHP Or PHP framework?

Newbie Spellweaver
Joined
Nov 24, 2012
Messages
59
Reaction score
5
I have an upcoming project and our instructor lets us decide which method to use
I'm just confused where i'll hard code it from scratch or use a php framework?

Thaaanks guys! Love lots! :eek:tt1::eek:tt1:
 
Put Community First
Loyal Member
Joined
Oct 2, 2014
Messages
1,112
Reaction score
832
Up to you, really. Frameworks have methods pre-made that baseline PHP won't have, and there are lots of employers that will want you to know a PHP framework. However coding your own PHP from scratch is a good learning curve, because you want to understand the language BEFORE using a framework.

If you're comfortable with PHP, then use a framework. If you're not comfortable, use this opportunity to brush up on coding your own PHP.
 
◝(⁰▿⁰)◜Smile◝ (⁰▿⁰)◜
Developer
Joined
May 29, 2007
Messages
2,167
Reaction score
898
If you're comfortable with PHP, then use a framework. If you're not comfortable, use this opportunity to brush up on coding your own PHP.

Perfectly sums up what I was going to say.
 
Newbie Spellweaver
Joined
Nov 24, 2012
Messages
59
Reaction score
5
How about security-wise how do the two compare?

Is it safe to use pure php in like coding for clients ? Or using a framework provides more security ?
 
Put Community First
Loyal Member
Joined
Oct 2, 2014
Messages
1,112
Reaction score
832
In terms of security they're both identical.

You need to understand that a framework is really just another way of writing PHP, it's still built using the same language, so it has the same potential to be secure and insecure. Frameworks have functionality out of the box to help prevent some security issues, but you can create the same functionality in PHP yourself as well. All frameworks do is offer another way of writing PHP, with new functions that give you more flexibility and security at a quicker speed to maximise efficiency.

Everything PHP frameworks can do, you can do in regular PHP, just differently. If you're still learning PHP, stick to using basic PHP. If you're decent at PHP and can understand the language in-and-out, then you can use a framework. Otherwise stick to normal PHP.
 
Joined
May 23, 2008
Messages
1,071
Reaction score
574
If you're inexperienced and the project is small, it's a good opportunity to learn by trying to write it yourself.

If you're inexperienced and the project is not small, you will likely find that you are able to build a product or application faster using a framework. If the project is results-focused, a framework may help you get to your intended result faster and with the end result having a more maintainable code base.

Do read through Getting Started docs, documentation related to what you'll be using the framework for, and quality open source implementations of the framework to get an idea of how to use the framework effectively.

That being said, if you have a lot of time on your hands and want to focus more on learning PHP rather than building an app, then trying to make your own code base from scratch can be a great learning experience. There are a lot of antipatterns and pitfalls to be had though, and you may very well rewrite your entire code base numerous times over. Be mindful of that, keep improving, keep reading, and keep questioning both yourself and the code and opinions of others that you read about. Understanding core principals around architectural design patterns is likely going to be important, and won't come to you instantaneously.

If you're doing work for a client, please use a framework. You get improved maintainability out of the box - other software programmers now or down the line will generally have a much easier time working on a preexisting framework with specific standards, structures, and documentation, rather than anyone's homemade code.

Security-wise, please choose the framework. While learning about security is good, perhaps by trying to write your own code, using a framework is not only easier, but much more appropriate and safer. A proven framework will generally be written and audited by people that have a lot more experience than you and notably a better eye for security.

A small team or individual writing home-grown code is much more prone to forgetting or not knowing or incorrectly attempting to handle security issues. Security is easy to screw up for everyone. Things slip through the cracks, this happens to the best of us. So don't take chances. Rather than writing their own code, even professional software engineers will generally leave important security implementations, e.g. password hashing, to well-tested open source solutions.

Best of luck, and whatever you choose, make sure to have fun with it :).
 
Last edited:
Joined
Jun 10, 2009
Messages
658
Reaction score
140
In my opinion, if you know some PHP and you have a new project, then you should start learning the following things

* Using composer dependency manager in your project
* A modern PHP framework like Laravel or Yii2

I say this because you can save lot of your time as most of features that are needed for any project i.e. boilerplate code is already written in a framework. Frameworks also make you stick to a well defined code structure so there's less chance of making your code a mess. Composer helps you import 3rd party code without much hassle.

tl;dr USE A FRAMEWORK FOR ANY PROJECT SO YOUR CODE LOOKS SANE EVEN AFTER A DECADE :thumbup1:
 
Put Community First
Loyal Member
Joined
Oct 2, 2014
Messages
1,112
Reaction score
832
Let's also factor in that this is for their upcoming project in their course, so they have limited time. Might be time better spent using raw PHP opposed to learning a framework right at this moment. RakisTa what type of project is it, what's the project scope?
 
Newbie Spellweaver
Joined
Nov 24, 2012
Messages
59
Reaction score
5
Let's also factor in that this is for their upcoming project in their course, so they have limited time. Might be time better spent using raw PHP opposed to learning a framework right at this moment. RakisTa what type of project is it, what's the project scope?

The project that we're going to do is a loaning system that involves several functions ( Accounting stuff)
and I was planning on doing a similar project for a client.

Gonna go for pure PHP for the project and framework for the client right?

what framework would you guys suggest for me to start off ?
 
Put Community First
Loyal Member
Joined
Oct 2, 2014
Messages
1,112
Reaction score
832
For your school project I recommend using PHP without a framework, on the side it will be worth learning a framework for when you get to the client project, yep. Need to check the client requirements though, if they want it to interface with their software system, or become available as a web app (which is quite popular these days), PHP won't be all that you need.

As for what framework to learn, I recommend Laravel or Magento (if e-commerce).
 
Back
Top