Raw PHP vs Framework
#1
Hello,

So, I began developing my website about a year ago. I was fed with having to pay for WHMCS, not because it's bad but because it's not thought for free hosting, and it certainly showed. Besides, it's integration with MOFH was pretty lacking, so I said "let's do it" and started working on it. At the beggining I was quite new to programming and didn't know frameworks existed, so I grabbed a simple, yet complete registration system written in PHP and started from that.

After a year of working on it, the backend looks nothing like the original, as I have been customizing it to fit my specific needs and visions. My website is working smoothly as I have been fixing bugs as I find them. However, I have not released it properly because I fear it might not be ready for production environment, but that might be just me being paranoic.

Anyway, back to the question. Do you think it's worth the time and effort to "migrate" my system from raw PHP to a framework, considering what I have right now is supposedly working ok?
Previously Tavoid on the YouHosting Forum
Feel free to PM me shall you need anything!
  Reply
#2
First of all, if you like what you have now, don't listen to anyone telling you how it should be done. If it ain't broken, don't fix it.

That said, if you're planning to build something new, I would highly recommend using a framework, because:
- It handles a lot of boring stuff for you. Things like loading the correct action for a request (routers and controllers) and accessing a database (ORM). In most cases, you can get the components standalone as well, but a framework is designed to work well together from the start.
- It forces good design on you. Frameworks slightly restrict how you can write your code, but as soon as you make the most use of the tools offered by the framework, you'll be able to write clean, reliable code with minimum effort.

In short, frameworks makes it easy and fast to write good applications.

As for whether you should migrate, that's your decision. Do you want to learn? Do you have plans to change functionality in the future? Do you have time to do the migration? I can't make that decision for you.

P.S.: I tried to sign up to your site to see how well it worked, but I see an error on the recaptcha saying "invalid domain for site key".
Owner of InfinityFree (formerly Grendel Hosting) and XVHOST.
  Reply
#3
(03-26-2017, 04:54 AM)Hans Wrote: First of all, if you like what you have now, don't listen to anyone telling you how it should be done. If it ain't broken, don't fix it.

As for whether you should migrate, that's your decision. Do you want to learn? Do you have plans to change functionality in the future? Do you have time to do the migration? I can't make that decision for you.

Perhaps you are right. It would be a lot of work to migrate at this point because everything is so tied to the system I'm currently using. In the beggining I was worried about XSS attacks or SQL injections, but I have taken measures to sanitize every user's input that's shown on the website (that is changing "<" to "<" and the like) and I use prepared statements for every SQL query so I should also be relatively safe from SQL injections. 

My code's a mess though, but I can understand it so I guess it's all right :v .

I'll look to learn a PHP framework (possibly Laravel) for any new projects though. 

(03-26-2017, 04:54 AM)Hans Wrote: P.S.: I tried to sign up to your site to see how well it worked, but I see an error on the recaptcha saying "invalid domain for site key".

Ah, yes, I keep the captcha not working on purpose so people that stumble upon my website can't signup yet until the website's ready.
Previously Tavoid on the YouHosting Forum
Feel free to PM me shall you need anything!
  Reply
#4
If you're comfortable with raw PHP, why waste time with a rewrite? The only thing I'd be concerned about is, as you mentioned, input sanitization.

If you do end up moving to a framework, I'd recommend Laravel as well.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)