PHP code example of keloola / errly

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

    

keloola / errly example snippets


use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Keloola\Errly\ErrlyManager;
use Throwable;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__ . '/../routes/web.php',
        commands: __DIR__ . '/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware): void {
        //
    })
    ->withExceptions(function (Exceptions $exceptions): void {
        $exceptions->report(function (Throwable $e): void {
            app(ErrlyManager::class)->handleThrowable($e);
        });
    })
    ->create();

use Keloola\Errly\ErrlyManager;

app(ErrlyManager::class)->handleThrowable(
    new RuntimeException('Test error dari Errly package!')
);
bash
php artisan tinker