Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@weblee 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

This comment has been minimized.

Copy link

@devonzara devonzara commented Jan 20, 2015

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

$paginator->links($view);

but rather:

$paginator->render(Presenter $presenter);
@mattstauffer

This comment has been minimized.

Copy link
Owner Author

@mattstauffer mattstauffer commented Jan 20, 2015

Thanks @weblee and @devonzara!

@devonzara

This comment has been minimized.

Copy link

@devonzara devonzara commented Jan 21, 2015

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

This comment has been minimized.

Copy link
Owner Author

@mattstauffer mattstauffer commented Jan 23, 2015

Thanks @devonzara!

@weblee

This comment has been minimized.

Copy link

@weblee 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

This comment has been minimized.

Copy link
Owner Author

@mattstauffer mattstauffer commented Jan 27, 2015

@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