Is there a guide to upgrade from Laravel 3 to Laravel 4?

I have a web page written in L3 and I feel that it will move it to L4 in time. Therefore, I am looking for an instruction manual telling me the porting process. In what folders are my old files now located and what parts of the code should be rewritten, syntax changes, etc.

+4
source share
2 answers

James Gordon wrote a good blog post with detailed sections to be changed.

Upgrading from Laravel 3 to Laravel 4

It took about three full days of effort (let’s call it 24 hours) to convert an application from Laravel 3 to Laravel 4. Not including app / config, app / lang, app / tests or any other Laravel code that exists in the project structure, both projects consisted of just over 2500 lines of code. The exact line takes into account the source project as follows:

Folders LOC controllers 540 assistants 183 models 927 tasks 384 views 476 Total 2,510

+7
source

An official change log should help you.

Also remember to change the method names. All snake_case method names are converted to camelCase .

Edit: folder names are almost the same. application folder has become an app , the paths to the folders of the model, view and controllers are still the same in the application folder. Migrations are now in the app/database/migrations folder.

Routing has changed a bit. :num :all , etc., now you can name them anything and set your rules using regular expression.

For example: This:

 Route::get('my/method/(:num)', array('as' => 'name', 'uses' => ' controller@method ')); 

became the following:

 Route::get('my/method/{id}', array('as' => 'name', 'uses' => ' yourController@yourMethod '))->where('id','[0-9]+'); 

( id is optional, you can call it anything.)

 Route::get('my/method/{foo}', array('as' => 'name', 'uses' => ' yourController@yourMethod '))->where('foo','[0-9]+'); 

For filters, you can now use app/filters.php instead of putting them in your routes.php .

+3
source

Source: https://habr.com/ru/post/1501788/


All Articles