We Create Digital Logo
Skip to main content

% blog read

What’s new in Laravel 5.7

Dean Appleton-Claydon

By Dean Appleton-Claydon

24th Sep 2018

Web development
What’s new in Laravel 5.7

You may have read previously about our preferred PHP framework Laravel, after 6 months of bug fixes and a year of security checks, Laravel 5.7 was released. Laravel is one of our areas of expertise and the new updates reinforce why it is one of our preferred platforms.

New features:


1. Console Artisan command testing:

Requesting user input, Laravel 5.7 allows for console command testing using various methods, such as expectsQuestion. In addition…

Code example:

Artisan::command('question', function () { ‘Do something’ });

2. Dump Server Integration:

Originally a package, this artisan command collects outputs in your current HTTP request. Instead of reviewing all the data being dumped on the server, all the API requests are caught and displayed on the console. This is useful to dump the data without all the browser HTTP errors.

Code example:

php artisan dump-server

Laravel now has customised pagination features, where on each side of the current link you can customise the quantity of links. With this new method there is no need to create custom pagination views. Thanks to a new API, you can define the link count on each side of the page.

Code example:

User::paginate(10)->linksOnEachSide(2);

4. Improved error message for dynamic calls:

In some cases it is useful to ask for the user’s input on the console; methods are in place to ask questions with another argument being the expected answer or multiple choice.

Code example:

Artisan::command('question', function () {
 $name = $this->ask('What is your name?');
});

5. Callable Action URLs:

With Laravel 5.7, there is no need to pass the full name of the controller, i.e. HomeController@index or ->name(‘index’), instead the controller class name is specified in the action and the URL name is automatically generated.

This action can also be referenced with the array syntax and accepts parameters as the second argument.

Code example:

return action([HomeController::class, ‘index’]);

6. Email Verification:

Authentication and user profile set up can/should implement some kind of verification of the user’s email. When implementing the new email verification a new column is added to the user’s table.

Now with Laravel’s Auth middleware, users can still register but can be restricted of authorities if their email is not verified. So the user’s verified email column is NULL, however once the user has verified their email address the column is replaced with a timestamp.

Code example:

Route::get(‘/‘, function(){
	return view(‘welcome’);
})->middleware(‘verified’);

References

Want to find out more?

Embark on a journey with us to transform your digital presence. Our collaborative approach ensures tailored solutions. Let's bring your vision to life together.
Get me started

Latest industry insights.

Explore the forefront of industry trends and innovations through our latest blogs where we unpack cutting-edge strategies, share expert perspectives, and keep you informed about the dynamic.
What is dark mode, and how does it help a website’s carbon footprint?
15 May 2025

What is dark mode, and how does it help a website’s carbon footprint?

Dark mode can reduce energy consumption and lower a website’s carbon footprint.

Why AI isn’t the threat everyone thinks it is
13 May 2025

Why AI isn’t the threat everyone thinks it is

With AI, the bigger risk is in underestimating its potential to help, not in fearing it blindly.

How do you know if an idea is a good idea?
08 May 2025

How do you know if an idea is a good idea?

We’ve been building a platform to solve the admin chaos agencies face – last week, we saw it strike a real chord.

Why it’s time to rethink the environmental impact of digital
06 May 2025

Why it’s time to rethink the environmental impact of digital

As the digital world expands, so does its environmental impact, and it’s time we paid closer attention to the hidden cost of our websites.

Core Web Vitals explained – and why they matter for SEO
30 April 2025

Core Web Vitals explained – and why they matter for SEO

Core Web Vitals are Google’s key metrics for measuring user experience, and they play a crucial role in how your website ranks in search results.

How to use AI agents in your business
29 April 2025

How to use AI agents in your business

One of the most accessible and practical AI trends for businesses is the rise of AI agents.

Why choose Magento for your eCommerce business?
24 April 2025

Why choose Magento for your eCommerce business?

Looking for an eCommerce platform that can grow with your business? Magento might be the perfect fit.

Planning your next web project: when to redesign vs rebuild
17 April 2025

Planning your next web project: when to redesign vs rebuild

A well-planned web project starts by deciding whether to redesign for visual updates or rebuild for long-term scalability and performance.

Stripe vs PayPal on sustainability
16 April 2025

Stripe vs PayPal on sustainability

A comparison of Stripe and PayPal’s approaches to sustainability, focusing on their climate strategies, transparency, and opportunities for user participation.

AI-generated content is now officially on Google’s radar
15 April 2025

AI-generated content is now officially on Google’s radar

Google is now telling its quality raters to flag AI-generated content as “Lowest quality” if it shows little effort, originality or value

Got a project in mind?