How to gradually convert a site to CodeIgniter?

I did a lot of research regarding OO and MVC for PHP and almost made the choice to switch to CodeIgniter for the existing large-scale website that I am managing. I believe that the use of the OO + MVC environment has huge organizational and operational advantages and, I hope, improves the development speed compared to the existing functional / procedural structure that the site uses now.

However, due to the huge size of the site, I would like to gradually transfer the code to the CodeIgniter structure, thereby having a transitional period of time when parts of the site are in CI and others are in the old style.

Are there any suggestions on the best way to do this in terms of code structure while minimizing the number of duplicate code? I'm also quite new to OO, and I think gradual is the best way to do this because of the learning curve.

+7
source share
3 answers

You can install CI in a folder and redirect (though .htaccess ) only the requests that you want to handle using CI. Other than that, everything should work as usual, and you won’t need to change a significant portion of your current functions. The more sections that work on CI, the more there will be redirection rules.

+2
source

I think you need to define dependent objects in your database (models) and start over with them again, for example, some contacts, user registration, etc.

The most reliable and safe way is to copy the current working site to the local computer and start it gradually, until you finish all this, upload it to a public web server.

+2
source

I would just write the whole site (almost) from scratch, locally, and then when everything working and tested uploaded it to the server.

Almost from scratch, I mean that you can copy some of the HTML into the View files and maybe use some of the existing PHP to build the backend parts, but I think you'll have to write most of this from the beginning. I made a large-sized website in an object-oriented way using the MVC template, and even submitting it to CodeIgniter would not be a trivial task, much less a website written completely procedurally. It's my opinion.

0
source

All Articles