StilgarBF
StilgarBF

Reputation: 1060

How to migrate an app to CodeIgniter

I have a legacy-app in PHP which I want to migrate to a framework. There around a hundred files forming an admin-backend. Most of the code is not even object oriented, some has never been touched by me. There is no time for a complete refactoring, but I have to add some features and need to rebuild others. I hope to rebuild component by component.

There is a need to keep everything working in the process - maybe without the users even noticing the changes. I plan to rebuild the UI in CodeIgniter, linking in the older parts until they have been replaced.

This is the directory-structure in short:

my question is: Would it be the best to throw CI in that admin-folder, rename the old index.php and do some rewriting to enable both parts to work? Is there a better approach to separate legacy and new code?

Upvotes: 0

Views: 690

Answers (3)

Vizeroth
Vizeroth

Reputation: 11

I realize this is a bit late, but I ran into the same type of issue. What I ended up doing is using Bonfire (which is based on CodeIgniter) in a sub-folder and calling it from existing pages using AJAX requests until we have time to complete a site redesign, which will use Bonfire throughout.

Of course, this was probably a little easier in my case, because the site I am working on had almost no dynamic or data-driven elements, or an administrative interface. Just years of pages thrown together in whatever fashion made sense at the time.

Upvotes: 1

Shattuck
Shattuck

Reputation: 2780

I would have to say that trying to switch what you described to a framework is a bad idea and could lead to some hack jobs to make sure things are working. My suggestion would be to start from scratch.

If you were to start from scratch you could leave what is currently up untouched and upon, finishing the new app, upload it without having anything go down.

If you really need to start adding new features I would look into adding components (such as Symfony2 components), instead of adding an entire framework. Add it to a git repository and work on a developer branch so users can't see any changes until you merge in the (working) changes.

Upvotes: 1

alvariux
alvariux

Reputation: 23

It would be better if you complete refactor the app, even just the admin part for start. If you plan to use the framework you need to apply the MVC pattern to your existing files which is not a simple copy paste.

Happy coding

Upvotes: 1

Related Questions