Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Setup Laravel 5.7 Application in Just 1-click on Different Cloud Providers Like GCE , AWS , DO , Linode , Vultr Deploy Now!

Install Laravel 5.7 & Checkout the New Amazing Features

Updated on September 13, 2018

8 Min Read
install laravel 5.7 and features
Reading Time: 8 minutes

In recent years, Laravel has made its name among the list of top PHP development platforms. It is a top choice of PHP developers and is one of the most popular frameworks in the market.

It contributes in many open-source projects. While supports many businesses to create enterprise level applications.

It’s latest version Laravel 5.7 released last month in August 2018 and quickly received tremendous feedback from the developers community. Installing Laravel 5.7 is quite easy and provides developers the ease to perform complex tasks.

The main features of Laravel 5.7 includes bug fixes till February 2019 and security fixes till August 2019, which was one of the top question of developers. The release is the improvement of previous Laravel 5.6 version. While it also includes some new features for advanced functionality.

Installation of Laravel 5.7 & New Features
1. Prerequisites
2. Install Laravel 5.7 within Clicks
3. What’s New in Laravel 5.7

4. Why Cloudways?
5. Summarizing Up

So in this article, I will demonstrate the installation process of Laravel 5.7 on Cloudways and its new amazing features. The article also shows the Laravel 5.7 upgrade process and few other enhancements and bug fixes.

Prerequisites

For the purpose of this tutorial, I assume that you have a Laravel application installed on a web server. My setup is:

  • Laravel 5.7
  • PHP 7.2
  • MySQL

Server level issues could mar your learning experience. In my case, I avoid these issues by using managed Laravel web hosting of Cloudways.

Cloudways offers a great development stack for hosting Laravel projects and takes care of all server level problems. You can try out Cloudways for free by signing for an account.

Install Laravel 5.7 within Clicks

To install Laravel 5.7, you first have to ensure the latest PHP7.2 version on your desired hosting. Since Cloudways already supports PHP7.2 by default, you don’t need to bother about any manual PHP configuration on the platform.
Besides it, Cloudways hosting allows you to install Laravel 5.7 within just one click. Below is the installation procedure of Laravel 5.7 on Cloudways, which demonstrates how easy is to install Laravel 5.7 on the platform within few minutes.

You Might Also Like: Benchmarks of Laravel 5 With PHP 7.2 on Cloudways Platform

In the application tab, select Laravel 5.7 and provide desired application name. Then click on the add application button and wait for the completion of installation.

After successfully completing the installation, you will see the below window, click on the application URL to view your Laravel application.

Once the Laravel 5.7 is properly installed, you will see the following Welcome page:

What’s New in Laravel 5.7

Now after installing Laravel 5.7 completely, let us we discuss some of the new features of Laravel 5.7.

  • Resources Directory Changes
  • Laravel Dump Server
  • Email Verification
  • Laravel Nova
  • Guest User Gates / Policies
  • URL Generator & Callable Syntax
  • Paginator Links
  • Notification Localization
  • Improved Error Messages
  • Testing Artisan Commands

Resources Directory Changes

Once you open the Laravel 5.7 application on your desired Code editor or IDE. You will see the directory structure changes in it. The Resource directory is made flattened and does not have any assets folder.

Taylor Otwell publicly said about this change in one of his tweet. As assets will no longer be in the Resource directory. Instead will contain JS, Sass, lang and views inside it.

Laravel Dump Server

Laravel Dump Server comes in a default package in Laravel 5.7. It is the development dependency in Laravel composer file. Instead of dumping data to the browser itself, it allows you to dump that data to the console or inside an HTML file.

php artisan dump-server

The above command executes a server in the background. It displays data through the console which is sent from the application. While Dump() works in the default scenario, when this command is not running in the background. You can get further information about Dump in its github directory.

Email Verification

Laravel 5.7 also introduces new optional email verification feature. You can use this feature by adding email_verified_at timestamp column in the user’s migration table. Which comes default within the framework.

While to give newly joined users the functionality to verify their email. Implement the MustVerifyEmail interface in the User model.

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements MustVerifyEmail
{
// ...
}

All the newly registered users receives an email address. Which contains an account activation link, once you implements the MustVerifyEmail interface. It activates their respective accounts as soon as they clicks on it.

Laravel 5.7 also provides a Middleware along with this email verification feature. Which works only with verified emails and not with unverified ones. As a result, this brings great feature to developers to ease their backend tasks.

'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,

To protect your routes only for verified emails, attach the middleware in the routes.

Route::get('profile/index', function () {
//
})->middleware('verified');

Laravel Nova

Released on August 22, 2018, Laravel Nova is officially out now in the market. You can purchase its initial release v1.0.* (Orion) from the official Laravel website. It is not a feature of Laravel, but is a separate package that helps performing various functional operations.

It is a precisely made, advanced admin dashboard for Laravel applications. The main feature of this package is to manage your database records using Eloquent ORM. It also supports various other functional attributes. That includes filters, lenses, actions, queued actions, metrics, authorization, custom tools and others.

To learn more about this package, visit the official Nova website.

Guest User Gates / Policies

The previous Laravel version has the functionality to return false, if it founds any unauthenticated user trying to access the application. But in new Laravel 5.7, you can declare an optional type hint or could input a null default value to allow guest users pass through the authentication checks.

Gate::define('update-product', function (?User $user, Product $product) {
// ...
});

URL Generator & Callable Action URL

Laravel 5.7 introduces a new callable syntax for action URLs. Which is same like the one in Laravel 5.6 that accepts string in action method. The main purpose of this new syntax is to directly enable you access the controller.

Basic syntax for callable syntax:

<?php
// PostsController is a controller
// index is a method name inside controller

$url = action([PostsController::class, 'index']);

The action helper in Laravel 5.6 only supports following style, to which you are familiar with.

<?php

$url = action('UserController@profile', ['id' => 1]);

The new callable array syntax gives you the ease to access controller files from any text editor. Like VSCode, Sublime, Atom or any other editor that supports code navigation.

Paginator Links

This new feature helps controlling additional links that are displayed on either side of the paginator URL window. Working on pagination before, you would have seen three links in it which is by default. But in Laravel 5.7 you can define them explictly, giving you more ease to handle pagination precisely.

{{ $paginator->onEachSide(5)->links() }}

Read More About: Guide To Create Vue Pagination in Laravel

Notification Localization

In new Laravel 5.7, you can send notifications in any language by assigning locale for it. The Illuminate\Notifications\Notification class adds new locale method for assigning desired language.

$user->notify((new NewUser($user))->locale('np'));

While to set localization for multiple notifications, you can also use facades for the task.

Notification::locale('np')
->send($subscribers, new WeeklyNewsletter($newsletter))

Improved Error Messages

Laravel 5.7 also gives you the functionality to easily track your error messages. As in Laravel 5.7, you can get short messages explaining the non existence of method or any other attribute. Instead of just pointing out the underlying object with confusing red lines.

You Might Also Like: Simplify Laravel Error Logging with PHP Rollbar Integration

Testing Artisan Commands

Mohamed Said, the first Laravel employee contributes in the new framework with test artisan commands. From his Twitter handle, he gave a bit introduction about this feature earlier. And now you can find it in the official documentation as well. With this new feature, you get a simple API in the framework that helps testing console apps asking for user input.

class InstallCommandTest extends TestCase
{
public function testInstallTest()
{
$this->artisan('app:setup', [
'name' => 'Setup New Project'
])
->expectsQuestion('Are you sure you want to start installation ?', 'Yes')
->expectsOutput('Initializing...')
->expectsQuestion('Please select your preferred version', 'v2.5')
->expectsOutput('Installing...')
->expectsQuestion('Do you want to run composer dump -o ?', 'Yes')
->expectsOutput('Generating Optimized Autoload Files...')
->assertExitCode(0);
}
}

Why Cloudways?

Performance

To optimize Laravel app performance, Cloudways hosting provides a unique set of stack called Thunderstack. It comprises of various web optimization tools like Memcached, Varnish, Redis, Nginx, PHP-FPM and many others to help developers get fast content delivery speed and faster page processing.  

Cloudways provides its own CDN service called CloudwaysCDN which helps boosting response time of your application with better performance. You can easily integrate it with your Laravel app within few clicks. While for optimized website performance, Cloudways hosting provides latest PHP7 versions, with which you can easily migrate your existing Laravel applications within minutes.

Security

Cloudways also provides free one-click SSL certificate installation for website security. While the auto healing servers of the platform ensures that your data remains safe in case of any accidental app failures.

For backup purposes, Cloudways provides Automated backup feature which helps you to set automated data backups of any frequency (every 1 hour to every 7 days).

While the IP whitelisting feature allows you to set up secure connections with unrestricted SSH and SFTP access.

To easily deploy Laravel applications on Github, Cloudways also provides unique Git deployment feature which helps you to deploy apps on Github using just SSH keys.

 

Summarizing Up

So this article covers the brief detailing of new Laravel 5.7. It covers the complete process of installing Laravel 5.7 on Cloudways and usage of its new features. Laravel 5.7 is pretty advanced in comparison to its previous version. It introduces diverse functionalities which makes it on top of the PHP frameworks charts. While the enhanced features of Laravel 5.7 also includes bug fixes, security fixes and others.

So if you still have any questions regarding the new Laravel version, feel free to ask them in the comments section below.

Share your opinion in the comment section. COMMENT NOW

Pardeep Kumar

Pardeep is a PHP Community Manager at Cloudways - A Managed PHP Hosting Platform. He love to work on Open source platform , Frameworks and working on new ideas. You can email him at pardeep.kumar@cloudways.com

Launch Laravel apps with 1-Click Install. Painless Server Management

Deploy your apps on optimized Laravel hosting servers.

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

THERE’S MORE TO READ.