by Devin Yang
(This article was automatically translated.)

Published - 5 years ago ( Updated - 5 years ago )

Laravel 5.7.x, the artisan command starts to support and integrate Symfony's dump-server.
Through the artisan command, start the dump-server, and we can display the dump data on the console.
php artisan dump-server
Or, transfer the dumped data into html format.
php artisan dump-server --format=html > dump.html

So let me use D-Laravel, give it a try.
First, simply use D-Laravel's bash (./create test10) to create a new Laravel Project,
Check whether the version is above Laravel 5.7.x by alias ( a --version ).
Here, a in the figure below is the alias of php artisan of Laravel.
If you don't know the a alias setting of D-Laravel, please refer to this.

OK, then start dump-server, enter a dump-server.


Because it is just a simple test, I directly modify the welcome.blade.php file, the content is as follows:
In the code below, I want to use the dump() function to print out $ test variable, to the console terminal.
 @php
    $test="TEST";
    #Measurement dump-server prints data
    dump($test);
    @endphp

    Test dump-server and
    dump(); function

Load the page and see if anything gets dumped.

In the browsing screen above, we can see that once the dump-server is started, the dumped data will not be displayed in the browser,
Instead, the TEST variable is dumped from terminal.

Cool!!

Tags: laravel

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


laravel

How to use Laravel's Validator to customize error messages

When we usually develop Laravel, sometimes field validation is performed, but the default message using Validator is in English. But of course I want to have a more accurate display of Chinese message display, This article describes how I use Laravel's Validator to customize Chinese messages.

dlaravel

How to directly execute the php artisan of different projects in the container on the host.

This article is the application teaching of D-Laravel, how to directly execute php artisan in the container on the host side. After customizing the alias, you can directly execute php artisan in the contianer in the project folder on the host side. alias a="../../artisan.sh"

Laravel,artisan

About the operation of --env in Laravel's artisan

This article uses Laravel 9.40.1 for operation. I believe many people know the usage of --env, but I still provide some information for Laravel beginners. In the artisan command, we can use --env to specify different .env files, so that under different subdomains, I can use different environments or even different databases. You should have also noticed that this site uses a multilingual environment, do you write two sets? Of course not, basically I created multiple .env in the same Project.