Porting a non-framework PHP project to Laravel 4.x Porting a non-framework PHP project to Laravel 4.x laravel laravel

Porting a non-framework PHP project to Laravel 4.x


TL;DR

Don't do this.

Common misconception

If you have an existing project, then grafting it on a framework will gain you no benefits. Frameworks are not some magic sauce, which miraculously makes the code better or make the site run faster.

Instead, frameworks are tools, that (supposedly) help you write the project in a shorter amount of time by having the "common tasks" already done. Also, as a side effect, it is extremely difficult to stop using a framework in a project (if it, for example, gets discontinued), because all of your code now is tightly welded to a framework.

This is why you are currently having these problems:

  • How can I overcome these "uncompatibilities" under Laravel without having to rewrite instantly all my PHP code?

    You cannot. Rewrite it exactly as the Laravel framework wants you to or it won't work.

  • (..) is there any PHP framework that, thanks to its internal structure, would make this task easier?

    No, there are not. All the popular frameworks will want you to rewrite your code so that it is bound to a framework.

The better approach

But you already have a working application. You will have better results, if you focus on improving the existing code base:

  • make sure you follow SOLID principles
  • separate your business logic from you presentation and database abstraction
  • start adding unit tests for the really shady parts of your code
  • refactor, refactor, refactor

P.S.: the materials listed here wold probably help