Laravel Debugging Tools Anbu Use

Source: Internet
Author: User

Reference phphub:laravel Another debugging tool Anbu, inside the installation of less than one step did not write, reference Github:https://github.com/daylerees/anbu

Installation:

composer.jsonAdd in the require field"daylerees/anbu": "dev-master"

" require " : {    "laravel/framework""4.2.*",     " Daylerees/anbu " " Dev-master " }

Performcomposer update

Then add the corresponding config/app.php in theServiceProvider

Array (    ... ')    Illuminate\view\viewserviceprovider ',    ' Illuminate\workbench\workbenchserviceprovider ',    ' Anbu\ Profilerserviceprovider ',),

Add Anbu facade to the alias array

Array (    ... ')    Anbu ' = ' Anbu\facades\anbu ')

Publish a profiling resource file (publish Profiler asset files):php artisan asset:publish

At the same time, the corresponding database connection should be configured because Anbu introduces a table for storing related information.

Use:

In order to better see the relevant features, in the route.php file, we add the following test code:

//route.phpRoute:: Get ('/',function(){    //Debug, when you are  dd() risk exposing information to the users of your application. Instead, use-to-dump this data into the ad() ' Debug ' section of Anbu. AD (' foo '); AD (' 3 '); AD (' 30.33 '); AD (with (NewStdClass)->foo = ' Bar '); AD ([' Name ' = ' Zhangsan ', ' age ' = 14]); //timers, the facade added in app.php is prepared for this, and other places are useless to the Anbu class. Anbu::timers ()->start (' Test ')); Sleep(1);//Do something interesting.Anbu::timers ()End(' Test ', ' completed doing something. ')); //DB Query\db::table (' Anbu ')get (); //Log Entries\Log:: info (' info message ')); \Log:: Info (' another message ')); \Log:: Error (' Wrong message '); returnView::make (' Hello ');}); Route::p ost ('/foo/baz/boo ', ' anbu\\controller\[email protected] '); Route::p atch ('/foo/bar ', ' anbu\\controller\[email protected] '); Route::p ut ('/foo/bar ', ' anbu\\controller\[email protected] '); Route::d elete ('/foo ', ' anbu\\controller\[email protected] ');

Hide and disable:

First let me explain the concepts.

To hide was to eliminate the Laravel icon button from requests, so it won ' t interfere with certain content Ty Pes.

To disable are to stop the profiler from storing the request, and displaying the button. Data for this request would be lost.

You can hide the profiler using:

Anbu::hide();

Or you can apply the anbu.hide filter as a before filter to any route or route group.

You can disable the profiler using:

Anbu::disable();

Or you can apply the anbu.disable filter as a before filter to any route or route group.

Problem solving:

If A new module is added and then you might get an error when rendering a previous request.

Here's some things you can try if you had any problems. First can try updating Anbu with:

composer update

Secondly you can clear the previous requests with the following Artisan command.

php artisan anbu:clear

Laravel Debugging Tools Anbu Use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.