Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Php framework to slowly refactor an inherited site

I've recently inherited a medium-sized php site which is horribly coded. It violates every best-practices methodology, from MVC to DRY, is vulnerable to SQL-injection and everything in between.

I've visited the other questions and already put everything on a VCS and am considering the framework alternatives. However I'd like your opinions on a framework that lets me slowly migrate from the actual site to a framework controlled one.

Thanks.

like image 407
Jeduan Cornejo Avatar asked Nov 27 '25 16:11

Jeduan Cornejo


2 Answers

Zend Framework would actually be the best choice in my opinion, as it has a great use-at-will structure and it is no full-stack framework like most of the others.

That means that you can start with migrating the model-layer first without having to touch the view or controller part. And even when it comes to the controller part, you could first put everything into controllers without having to rely on the router, so you could still use your old URLs.

like image 88
DASPRiD Avatar answered Nov 29 '25 06:11

DASPRiD


I will put my vote in for CakePHP (http://www.cakephp.org). It has the ability to manage everything very nicely.

Template

This will allow you to create the base template / layout for the site. It is the main body of the site. You can store multiple layouts all in the views/layouts directory. You can identify what layout you want to use for any given page within the site.

Static Content

If you have static content pages, they all reside in views/pages. These will load into the layout wherever you put the <?php echo $content_for_layout; ?>.

Custom Code

Many times, you will have custom code that may not fit in the framework. No worries, you can add this to the libs or vendors folders and call the functionality from there.

Speedy Upgrade Via Bake

One of the cool features of cake is the bake feature. Once you have added your schema to the database, you can use bake to have CakePHP write all of the models (with relationships), the controllers (with basic CRUD and admin sections), and the views for each action within the controller.

Cake has been a great fit for all of the projects I have worked on. It keeps the code well organized, has a very active community, and their documentation is very well written and understandable.

UPDATE: For additional information about some sites who use cakephp you can see a sample list here: http://book.cakephp.org/view/510/Sites-in-the-wild

A few notable (high traffic sites) would be:

https://addons.mozilla.org

http://scratch.mit.edu/

like image 39
Chuck Burgess Avatar answered Nov 29 '25 05:11

Chuck Burgess



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!