PHP code example of php-bug-catcher / bug-catcher-reporter-bundle

1. Go to this page and download the library: Download php-bug-catcher/bug-catcher-reporter-bundle 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/ */

    

php-bug-catcher / bug-catcher-reporter-bundle example snippets


// config/bundles.php

return [
    BugCatcher\Reporter\BugCatcherReporterBundle::class => ['all' => true],
];

class Foo {
	public function __construct(private readonly BugCatcherInterface $bugCatcher) {
		
	}
	
	public function foo():void {
		$this->bugCatcher->log([
			"message"     => "My message",
			"level"       => 500,
			"projectCode" => "dev",
			"requestUri"  => "my uri",
		]);
		$this->bugCatcher->logRecord("My log record", 500);
		$this->bugCatcher->logException(new \Exception("My Exception"));
	}
}