Download the PHP package swayok/laravel-extended-errors without Composer

On this page you can find all versions of the php package swayok/laravel-extended-errors. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-extended-errors

What is this

This package provides additional drivers (telegram and email) and log renderers for Laravel logging system. Renderers generate HTML code to be written to log files or sent to external services (slack, email, telegram).

Example of logs: screenshot_log.png

Example of exception log: screenshot_exception.png

1. Installation

Laravel <= 5.5

Add require to composer.json and run composer update

"require": {
    "swayok/laravel-extended-errors": "5.5.*",
}

Proceed using step 2 in branch laravel_up_to_5.5

Laravel 5.6+ to Laravel 9

Add require to composer.json and run composer update

"require": {
    "swayok/laravel-extended-errors": ":6.0",
}

Laravel 10+

Add require to composer.json and run composer update

"require": {
    "swayok/laravel-extended-errors": ":7.0",
}

Configuration

Service provider

Automatically added via package auto-discovery.

Renderers

HTML renderer injection into daily and single channel drivers

'single' => [
    'driver' => 'single',
    'path' => storage_path('logs/laravel.html'),
    'tap' => [\LaravelExtendedErrors\Formatter\HtmlFormatter::class],
    'level' => 'debug',
],

'daily' => [
    'driver' => 'daily',
    'path' => storage_path('logs/laravel.html'),
    'level' => 'debug',
    'days' => 7,
    'tap' => [\LaravelExtendedErrors\Formatter\HtmlFormatter::class],
], 

Drivers

All changes will be applied to 'channels' array in config/logging.php.

Telegram channel

'telegram' => [
    'driver' => 'telegram',
    'token' => env('LOG_TELEGRAM_API_KEY'),
    'chat_id' => env('LOG_TELEGRAM_CHAT_ID'),
    'proxy' => [
        'type' => env('LOG_TELEGRAM_PROXY_TYPE', 'http'),
        'host' => env('LOG_TELEGRAM_PROXY_HOST'),
        'port' => env('LOG_TELEGRAM_PROXY_PORT'),
        'user' => env('LOG_TELEGRAM_PROXY_USER'),
        'password' => env('LOG_TELEGRAM_PROXY_PASSWORD'),
    ],
    'level' => 'debug',
    'bubble' => false',
]

Rendered logs and exceptions are sent as documents to provided chat_id

Proxy settings:

Proxy uses Basic Auth method to send user and password. Other auth methods are not supported right now. Make an issue if you need some (make sure CURL supports it).

Nginx vhost config to proxy requests to api.telegram.org

server {
    listen 80;
    server_name bot.yourdomain.com;
    location / {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass https://api.telegram.org/;
        client_max_body_size 100M;
    }
}

Email channel (probably won't work with Laravel 10+)

'email' => [
    'driver' => 'email',
    'level' => 'debug',
    'subject' => 'Server log',
    'sender' => '[email protected]',
    'receiver' => ['[email protected]'],
    'bubble' => false',
],

Warning: there is no limit for exceptions, and you may eventually get thousands of errors at once if you use this channels in high loaded project.

Sentry

Actually there is no channel driver for Sentry but here is quick tutorial on how to add exceptions reporting to Sentry via Handler.php:

Require sentry packages:

"require": {
    "sentry/sentry": "^1.8",
    "sentry/sentry-laravel": "^0.8.0",
}

In your app/Exception/Handler.php update report() method to look like:

public function report(Exception $exception) {
    if ($this->shouldReport($exception) && app()->bound('sentry')) {
        app('sentry')->captureException($exception, ['extra' => \LaravelExtendedErrors\Utils::getMoreInformationAboutRequest()]);
    }

    parent::report($exception);
}

To .env file add url provided by Sentry when you create a new project there. It will look like this:

SENTRY_DSN=https://[email protected]/1

Note that there is 'extra' key used to send report to Sentry. This one stores all data from current request just like exception logs generated by HTML Renderer. This provides better understanding of what happened.

Whoops exception page replacement

To replace HTML exception pages rendered by built-in Laravel's Whoops handler with exception page rendered by this package you need to add 'replace_whoops' => true, to config/logging.php

Custom user info data collector

ExceptionHtmlRenderer prints minimal set of user info: primary key and class. To print more info you can provide your own user info collector using ExceptionHtmlRenderer::setUserInfoCollector(\Closure). Closure
receives no arguments and must return null (not authenticated) or array. Also, it is on your side how you get user object. ExceptionHtmlRenderer by default uses request()->user();


All versions of laravel-extended-errors with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
laravel/framework Version >=10.0
telegram-bot/api Version ^2.3.15
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package swayok/laravel-extended-errors contains the following files

Loading the files please wait ....