Using legacy CodeIgniter project inside Laravel

Viewed 29

I have a legacy project built on codeigniter 3 and we're looking to upgrade to the latest Laravel version. From some of the answers here, I can infer that it is definitely possible, I have multiple questions before starting.

  1. Would it be practical? (would making it work with each other be a huge enough pain to completely rebuild the system on laravel)
  2. Would it work across different PHP versions? (Current: 5.something; desired: 8.1)
  3. If they're both running on the same domain, would session management be an issue? (would I be able to share session variables across the frameworks?) Thanks for reading
1 Answers

It looks like CodeIgniter uses lots of global variables.

https://codeigniter.com/user_guide/general/common_functions.html

I'm not a Laravel dev, but I'm assuming that as a relatively modern framework, Laravel does not rely on many globals by default. So I suppose there's more opportunity for conflict, but only if someone is abusing Laravel.

(Laravel people: Feel free to correct me on this.)

Regarding PHP 8: CodeIgniter has at least passed this guy's smoke test on PHP 8.

https://forum.codeigniter.com/thread-78091.html

Since minor versions theoretically don't contain breaking changes, you may find success on 8.1 as well.

Regarding sessions: I know nothing about how either framework handles sessions, so I can't speak to this.

As for whether it's a good idea: I'm not sure I fully understand what you're trying to do. Are you going to have a CodeIgniter project running side-by-side with a Laravel project, using a separate subdomain for each? Or are you going to try to make the existing CodeIgniter project live inside of a Laravel directory structure, as the title of the question currently implies?

If the latter, I would say you're in for some tears. It sounds very painful. The former could work pretty well, I would imagine, especially if you're already using your PHP mainly to serve API endpoints and can just gradually move all the endpoints over to the new platform, one at a time.

I hope this helps.

Related