Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cakephp and Laravel coexisting

I do receive a chalenging task to migrate a old legacy cakephp 2 app to laravel 5.2.

The two must coexist and work togheter, while all modules are migrated to laravel because it is a large app.

Is it possible/feasible? the auth session credentials can be transported to laravel auth session easily?

What kind of traps you can find int this proccess? and how can i avoid them?

I have only found these steps : http://laravel.io/forum/09-08-2014-strategy-for-migrating-a-large-cakephp-project-to-laravel?page=1#reply-28620

Anyone already done this before ?.

like image 575
Ângelo Rigo Avatar asked Nov 13 '15 10:11

Ângelo Rigo


People also ask

Is laravel better than CakePHP?

CakePHP – As CakePHP is mainly preferred for small projects it is also not considered for data backup and handling tasks. It is not good in terms of data backup and handling used in web development projects. In comparison to CakePHP, Laravel is a better choice in terms of data back and handling.

What is the difference between CakePHP and laravel?

Key differences between Laravel and CakePHPLaravel works on the object-oriented model, while CakePHP works on the document-oriented database model. Laravel is based on Model View Controller (MVC) architecture, while CakePHP has implemented on the Hierarchical Model View Controller (HMVC) architecture.

Is CakePHP easy to learn?

Is CakePHP easy to learn? CakePHP is a powerful open-source PHP framework that is easy to learn.


1 Answers

The by far most logical solution would be to transfer the entire application over to Laravel at once. However, if that's not a possibility, it should still be possible. If you keep sessions in Redis, they'll of course be accessible by both applications. The main issues might be:

  1. You want a User object on the Laravel app to authenticate, but authentication happens in the Cake app. Hence, you might need to reauthorise somehow in the Laravel application. However, if you know the session is valid and you have the user ID, you can do this without issue.
  2. The session token is generated differently: Laravel will generate its token through one algorithm, using its application key. Without any knowledge of CakePHP, I'm confident the session key is generated differently. You might be able to surpass this by modifying the generation of the key for them to match. Otherwise, you'll end up with issues for hashing salts, CSRF verification and whatnot if those things go between the applications.
like image 166
Phroggyy Avatar answered Oct 03 '22 03:10

Phroggyy