PHP code example of larvabug / larvabug-laravel

1. Go to this page and download the library: Download larvabug/larvabug-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

larvabug / larvabug-laravel example snippets



'providers' => [
    LarvaBug\Provider\ServiceProvider::class,
],

'aliases' => [
    'LarvaBug' => \LarvaBug\Facade\LarvaBug::class
],


public function report(Exception $exception)
{
    LarvaBug::report($exception);
    parent::report($exception);
}

try {
    //Code here
 }catch (\Exception $exception){
    LarvaBug::report($exception); 
}

$metaData = ['custom_data' => ['x','y','z']]; //Array
LarvaBug::log('Log message here',$metaData);

public function render($request, Exception $exception)
{
    if (LarvaBug::shouldCollectFeedback($exception) && !$request->wantsJson()) {
        return LarvaBug::collectFeedback();
    }
    return parent::render($request, $exception);
}
bash
php artisan vendor:publish --provider="LarvaBug\Provider\ServiceProvider"