Laravel

Understand Uses of Laravel 5.7 Dump Server

Laravel 5.7 new update includes supports of Symfony’s dump server command. 

If you run php artisan command on your laravel 5.project you will see new command called dump-server and it says “Start the the dump server to collect dump information” 

So basically the dump server command help us to see details dump information on terminal itself without affecting the web page. all we can say is – It is a quick way to have details right in front of the developer without reflecting to the user.

Let’s see how you can use dump server.

Dump Server Example:

Open your routes file and add dump information to the welcome page route section as showing below.

<?php

Route::get('/', function () {
    $sampleArray = ['one', 'two', 'three'];
    dump($sampleArray);
    return view('welcome');
});

Now browse the page and you will see the dump information now being showed on the browser, this how we usefully used to do till laravel 5.6 framework. 

But now here is the main demonstration on dump server implementation comes into place.

Also Read – How to Enable Laravel 5.7 Email Verification Support

Execute dump Server:

Go ahead and open terminal or command prompt if your on windows and execute dump server command.

$ php artisan dump-server

You will see following interface of dump server listener, it says that the dump server is running and you can quit using Control + C.

Now open your browser and refresh the same page. you will see that the it removes the dump information from the page. 

And now you can checkout the terminal, the dump server caches the details dump information along with the times stamp and the file were it was executed.

Useful right? as a developer I often see many times I used to dump the information it is used to lock within the html tags and has to look out the page source to see in details. instead now we can use the dump server the easiest way to figure out what happening with the code.

One more thing the dump server will also work for die dump function that is dd(); and off course when you do that it will kill the execution further from dd function.

Cool feature right 🙂 so keep using while you do programming.

Yogesh Koli

Software engineer & Blogger live in India, has 8+ years of experience working with the Front-end and Back-end Web Application Development.

Recent Posts

Complete guide of using Laravel 6 Eloquent Subquery Enhancements

Learn How to use laravel frameworks new improved feature called Eloquent Subquery and get example…

3 years ago

3 Useful examples of using Array Map function in PHP – Best Practices

Learn how to use php array map function with easy and essential tutorial to modify…

3 years ago

Working with PHP Array Filter Function – Best Practices

Learn how to use php array filter function with easy and essential tutorial to filter…

3 years ago

How to add Access Modifiers with Constructor Parameters in TypeScript

Want to know how to refactor your Typescript class, Learn here utilising Typescript of the…

3 years ago

What is Access Modifiers and how to use Access Modifiers in TypeScript ?

What is Access Modifiers in typescript, how to use Access Modifiers, when to use them,…

3 years ago

Top 10 Super Useful Packages to Improve Laravel applications in 2019

This tutorial provide ultimate list of package those are top 10 on packagist and super…

3 years ago