Skip to content

Instantly share code, notes, and snippets.

@mattstauffer
Last active August 29, 2015 14:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattstauffer/a1a9852fa18da0ec3d80 to your computer and use it in GitHub Desktop.
Save mattstauffer/a1a9852fa18da0ec3d80 to your computer and use it in GitHub Desktop.
API changes to Laravel

The goal is to track all API changes to Illuminate components for the 4->5 upgrade.

If you run into any issues with using your Illuminate components the same way you did in 4, please leave them as a comment here so we can document it all.

Note that this is different from framework changes in terms of how you boot the application, structure your application, etc.--there's a separate gist for that.

Auth

Cache

  • If you wanted to create your own instance of Cache so you could use ::get, ::set, etc. you would've injected CacheManager. Now, CacheManager is responsible for returning an instance of Cache Repository, which is what you now want in order to use the cache methods.

Config

Console

Container

Cookie

Database

  • Query Builder & Eloquent no longer allow caching through remember(); you'll have to manually cache database results.

Encryption

Exception

Filesystem

  • Note about change to Flysystem

Events

Hashing

Html

  • Deprecated

Http

Log

Mail

Pagination

  • $paginator->links($view) has now been replaced with $paginator->render(Presenter $presenter).

Queues

  • Laravel 5.0 now requires "pda/pheanstalk": "~3.0" instead of "pda/pheanstalk": "~2.1" that Laravel 4.2 required.

Redis

Remote

  • Deprecated

Routing

Session

Support

Translation

Validation

View

Workbench

  • Deprecated
@weblee
Copy link

weblee commented Jan 20, 2015

Database:

Cache has now been removed from Query Builder, ie in L4 you could do.

$users = DB::table('users')->remember(10)->get();

Now you have to create your own caching implementation.

$users = DB::table('users')->get();
Cache::put('users:all', $users, 10);

A better suggestion would be to create a UsersCacheRepository and UsersDbRepository both implementing an interface. You would then Decorate UsersDbRepository with your caching layer.

@devonzara
Copy link

To show the pagination buttons/links, it's no longer:

$paginator->links($view);

but rather:

$paginator->render(Presenter $presenter);

@mattstauffer
Copy link
Author

Thanks @weblee and @devonzara!

@devonzara
Copy link

Also might be worth noting the blade syntax change in View to escape HTML...
{{ }} -> {!! !!}

It's already in the upgrade guide, but worth mentioning here to have a complete list.

@mattstauffer
Copy link
Author

Thanks @devonzara!

@weblee
Copy link

weblee commented Jan 27, 2015

Hey Matt,

Where to register Console commands has now changed. You place them within app\Console\Kerenel.php, This also ties in nice with the new scheduling.

@mattstauffer
Copy link
Author

@weblee Thanks! I'm calling that a Framework change rather than an API change, but thanks for noting it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment