I've got a webpage written in L3 and I feel that it's on time to move it forward to L4. So I'm searching for a howto-guide telling me the porting process. In which folders my old files belonges now into and which parts of code have to be rewritten, syntax changes and so on.
James Gordon wrote a nice blog post detailing the various sections that would need to be changed.
Upgrading from Laravel 3 to Laravel 4
It took roughly three full days of effort (lets call that 24 hours) to convert the 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 a little over 2,500 lines of code. The exact line counts for the original project are as follows:
Folder LOC controllers 540 helpers 183 models 927 tasks 384 views 476 Total 2,510
Official changelog should help you.
Also don't forget to change your method names. All snake_case
method names are converted to camelCase
.
Edit: folder names are almost same. application
folder became app
, model, view and controllers' folders' paths are still same under the app folder. Migrations are now in app/database/migrations
folder.
Routing has changed a bit. the :num
, :all
etc is dropped, now you can name them anything, and set their rules with regex.
E.g: This:
Route::get('my/method/(:num)', array('as' => 'name', 'uses' => 'controller@method'));
became like this:
Route::get('my/method/{id}', array('as' => 'name', 'uses' => 'yourController@yourMethod'))->where('id','[0-9]+');
(id
is not a must, you can name it anything.)
Route::get('my/method/{foo}', array('as' => 'name', 'uses' => 'yourController@yourMethod'))->where('foo','[0-9]+');
For the filters, you can now use app/filters.php
instead of putting them into your routes.php
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With