Laravel 5.3.0-RC1 released

laravel-5.3-rc1

Laravel 5.3.0-RC1 released

I almost forgot to write about this, almost. Could you imagine? A company that is such a strong advocate for Laravel not writing about 5.3!? That was lucky then. So, lets jump right in to it!

 

If you like Laravel, you’ll be just as excited as me about this news. Laravel 5.3 is bring some big features to the table which I will go through shortly. Now, if you’re a Laravel developer and you’re sat there wondering “should i upgrade my < 5.3 Laravel project to Laravel 5.3?”. The answer is, unfortunately, probably not. Remember that this is the Laravel release candidate. It’s there for you to test and things can (and likely will) still break and go wrong. But don’t worry, the full release is anticipated to be next week at Laracon EU. So hold off for now, don’t go full guns blazing on your live Laravel site. If you’re impatient and you want to ignore this advise, then I recommend running composer update daily, just so you’re on top of everything and all of the latest releases.

 

If you’d like to start using Laravel 5.3, well that’s nice and easy. Just run the following in the command line;

laravel new test-project --dev

 

Perfect! Now you’ve set up your demo project, you might want to check out the Laravel documentation which has now been fully updated to explain Laravel 5.3.

 

Okay, enough chit-chat. What’s cool in Laravel 5.3? Here are a few things that are worth talking about.

Laravel Scout

Laravel Scout is an interesting one and I cannot wait to use it. In fact, we have the perfect client that we service already that I want to propose using Laravel Scout on. Laravel Scout is a full-text search for Eloquent and even more importantly, it’s driver based. This means that anyone in the Laravel community can write their own drivers for it to extend the functionality. Laravel Scout currently only supports Algolia but not to worry because people are already writing their own drivers for it.

Laravel Scout works by simply adding a Searchable trait to your model and then syncing the data with the service using; php artisan scout:import App\\Model

Laravel Notifications

Laravel Notifications are handy because it allows you to easily send notifications through services like SMS, Slack and email. It ships with a handy view ready for you to use, also. Laravel Notifications are going to be useful for, say, when you update your site with new content. You can then easily email push a notification to everyone on Slack saying “Our site has been updated”, for example. Laravel Notifications are also Queueable, too. I will be writing a blog/tutorial on Laravel Notifications soon!

Laravel Passport

Laravel Passport lets you setup your own OAuth2 server, Laravel passport ships using Vue.js. This is awesome news for all of you API developers out there. It’s worth noting that Laravel Passport is an optional package and you will need to do some configuring to set it up like configuring User to use the authentication time, changing the API guard to use the Passport driver and running all of the migrations.

 

The amazing features of Laravel Passport are definitely going to come in handy. Laravel Passport even ships with the ability to administer users and client tokens in the user interface, meaning revoking access is a breeze!

Routing changes

Yup, there are routing changes to get used to in Laravel 5.3. But it’s for the good, so it doesn’t matter. I was expecting them to make this change at some point because it’s so much cleaner! The default routes file, app/Http/routes.php, no longer exists. It has been moved to the root directory inside of a new directory called routes (funny, that). From the get-go, you will notice 2 new route files; web.php and api.php. If you’re familiar with middleware, you’ll be right in thinking that the routes in web.php are wrapped in the web middleware group and the routes in api.php are wrapped in the api middleware group.

 

This is so much better for a few reasons. For one, organisation, how often have you had a HUGE route file and wanted to be able to cleanly organise it? Now you can! All you need to do is take a look at the new RouteServiceProvider; App\Providers\RouteServiceProvider to register new routes! This also means that because routes no longer sit in the app direction, the app directory is now a fully PSR-4 autoloaded directory.

 

Roll back a single migration

Oh yes. You can now finally roll back a single migration with a single command.

php artisan migrate:rollback --step=1

 

More flexibility with Blade foreach loops

We can’t forget about Blade! Blade has had a nifty new feature added to it too. You can now access the $loop variable from within a Blade loop, which will allow for things like this;

@if($loop->first)
    Do something on the first iteration.
@endif

@if($loop->last)
    Do something on the last iteration.
@endif

Pretty cool, right?

 

There are literally loads of new features and tweaks, literally too many to list. Hopefully this post gives you a brief idea of some of the new features that you can explore with Laravel 5.3. I’m excited for the official release date and I cannot wait to start using Laravel 5.3 officially!

 

Don’t forget, if you are looking for Laravel development, we are more than happy to help and you should contact us!