PHP code example of bitl / debug

1. Go to this page and download the library: Download bitl/debug 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/ */

    

bitl / debug example snippets


use BitL\Debug\BitL;

// Send a dump to BitL
BitL::dump($user);

// Or use the helper functions
bd($user);           // BitL Dump
bdd($user);          // BitL Dump and Die
bitl_dump($user);    // Explicit function name

try {
    // ...
} catch (\Exception $e) {
    BitL::error($e);
    throw $e;
}

BitL::query(
    sql: 'SELECT * FROM users WHERE id = ?',
    bindings: [1],
    time: 2.5,  // milliseconds
    connection: 'mysql'
);

BitL::mail(
    from: '[email protected]',
    to: ['[email protected]'],
    subject: 'Welcome!',
    html: '<h1>Hello World</h1>',
    text: 'Hello World'
);

->withExceptions(function (Exceptions $exceptions) {
    $exceptions->reportable(function (\Throwable $e) {
        if (class_exists(\BitL\Debug\BitL::class)) {
            \BitL\Debug\BitL::error($e);
        }
        return false;
    });
})

public function register(): void
{
    $this->reportable(function (\Throwable $e) {
        \BitL\Debug\BitL::error($e);
        return false;
    });
}



use BitL\Debug\BitL;

// Register error and exception handlers
BitL::register();

// Your code...

use BitL\Debug\BitL;

if (getenv('APP_ENV') === 'production') {
    BitL::disable();
}
bash
php artisan vendor:publish --tag=bitl-config