Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating from one PHP framework to another

I'm working with a web company that's approaching a point where it will likely need re-think the product as a V2 - due to outgrowing some of its V1 foundations and principles that have been built into virtually everything, from the data model to the user interfaces. For various reasons, this evolution might involve a migration from CakePHP (with which the V1 has been built) to Symfony or Zend.

I would like to ask for some experienced views on how people might have managed a transition like this for a website that has significant traffic and generates revenue. I don't want to open up a discussion on the pro's & con's of different PHP frameworks, or why this migration might be needed. Rather, I would be very interested in hearing whether there are some practical alternatives to essentially building a V2 from scratch alongside the V1 for a couple of months - and locking up precious coding time for the duration of this intense period. An example of such an alternative might be migrating an app in parts over a longer period of time.

I'd be grateful for any views from people who might have managed or been involved in such transitions.

Thanks in advance.

like image 231
Tom Avatar asked Jan 22 '23 03:01

Tom


2 Answers

Symfony makes it very easy to break out of the framework at almost every level in the process, making it easy to integrate with other frameworks. Here's how I would do this:

  1. Set up and install Symfony.
  2. Put the existing CakePHP project inside of Symfony as a plugin.
  3. Set the plugin to have a catch-all route that takes the parameters and processes it as a Cake PHP request. Now you have all your CakePHP pages working in Symfony. This is probably the trickiest step and may involve resolving some autoloading or other collision issues.
  4. You can now selectively migrate CakePHP models, controllers, and views.

A major benefit of this approach is that it lets you maintain an agile development process. You can port little bits of the website at a time all the way through and test them as you go.

like image 154
Jeremy Kauffman Avatar answered Jan 23 '23 16:01

Jeremy Kauffman


If you will be moving to Zend, you can start using Zend Classes one-by-one to help you with basic tasks. You can very well use any model class with ZF. So only think that will need that 'big bang' action will be the controllers/views. In fact you can also integrate your existing views with ZF. But I think that'S an overkill and it will not last very long...

So - wrapped up

  • switch to zend classes for basic tasks like RSS generation, emails, validation, etc. That will help you in the next step.
  • make the big bang action and switch (m)VC to ZF, leave models
  • switch models to something more Zend-ish
like image 30
Tomáš Fejfar Avatar answered Jan 23 '23 16:01

Tomáš Fejfar