1. Go to this page and download the library: Download krypter/catchor 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/ */
// Example
App::error(function(Exception $e)
{
Log::error($e);
});
'raw_files' => [
app_path() . '/exceptions/catchers.php', // By default
'/path/to/your/file.php' // Your path
]
namespace Acme\Exception;
use Krypter\Catchor\ExceptionCatcher;
class Catcher extends ExceptionCatcher {
// We will catch exception from here
}
// Template
public function catchException(\Exception $e, $code, $fromConsole)
{
return 'Do what you wanna do!';
}
// Real world example
public function catchNotFoundHttpException(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e, $code, $fromConsole)
{
return \View::make('pages.404');
}
public $raw = true;
public function raw()
{
// Example
App::error(function(Exception $e)
{
Log::error($e);
});
}