Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

zeke8402's avatar

Codeigniter Session with Laravel?

Hey guys... I am trying to come up with a game plan for converting my projects from CodeIgniter to Laravel. The problem is I have several applications currently in use in our company, and the main pitfall is that all of my applications share the same session stored in my database to allow navigation from app to app without requiring a login every time.

I was wondering if there was a way to use CodeIgniter Sessions in Laravel? If not, what is the best solution to convert my apps? If I can get Laravel to use CI sessions, then I can start writing new apps in Laravel and go back and rewrite my CI apps at my leisure.

0 likes
11 replies
bashy's avatar

Well it depends how your apps share the data but if it's database (would have to make cookie names the same), you could do it then renew the data...

Why not recode your apps then ask them to login once on the new system? I don't get it :P maybe there's a reason but normally it's fine?

zeke8402's avatar

Recoding my apps would be a massive undertaking and would break the session persistence, forcing them to relogin depending on what framework I use, I was just wondering if there was any easier way and maybe some guidance on the issue from anyone who might've been in the same situation.

bashy's avatar

Maybe I didn't understand this part correctly

plan for converting my projects from CodeIgniter to Laravel.

jesseschutt's avatar

Hey zeke8402 - Did you find out a solution for this? I'd be very interested in knowing!

zeke8402's avatar

Well, the only solution I could come up with was to implement my own session handler and use that in both CodeIgniter in Laravel. I have many apps tied to our database and I pride on the fact that they're seamless; if you have a session with one, then no login is required to access the others.

What I decided to do was to simply reimplement my system one app at a time. I wish there was some kind of Laravel plugin to interface with the CI sessions but I suppose anyone capable of doing that is planning on migrating entirely anyway XD

kkhicher1's avatar

@zeke8402 Same situation after 5 year bro. I want to redirect a CI auth user to laravel project with same database

abdurrahman_shofy's avatar

I know this is an old thread, however I think this case is actually pretty common so I would like to write what I could say about this topic.

To achieve synced user session between 2 web application, I think the cleanest method is use some Federated Identity protocol such as OAuth 2.0 or OpenID Connect. This approach allow for separated logics & concerns, thus achieve better encapsulation & modularity.

However if you insist on having 2 applications sharing the exact same session data (as the one attempted by @zeke8402 ), you could see my experiment in this repo: https://github.com/azophy/experiment-php-shared-session . To summarize, you would need to:

  • make sure both application use the same (centralized) session driver/storage
  • make sure both use the same serialization logic in their session storage
  • make sure both apps use the same cookie id variable name
  • make sure both has the same encryption setting for cookies

The result is quite dirty and tightly-couple, hence I suggest the previous approach. But this method should work

Please or to participate in this conversation.