Laravel Fejlvarp is a robust incident logger tailored for Laravel applications. Designed to streamline error tracking, it ensures that you're always in the loop about runtime errors, allowing for swift resolution.
Why Choose Laravel Fejlvarp?
- Instant Notifications: Get notified immediately when an incident occurs or is reopened via email or pushover.net.
- Intuitive Interface: A user-friendly web interface lets you delve deep into debug information about each incident.
- Seamless Integration: Designed to fit right into your Laravel application without any hassle.
Incidents overview | Incident detail view |
---|---|
This package is an enchancement of Fejlvarp by troelskn. Thanks for letting me envolve on the idea to letting it become a package for laravel.
negoziator has also been a great help in the process of making this package.
This project supports a range of PHP and Laravel versions, tested across multiple operating systems. Below are the details of the supported versions:
Laravel Version | PHP Versions | Required larastan/larastan |
Required orchestra/testbench |
Required orchestra/testbench-core |
---|---|---|---|---|
^9.47 | 8.0.2, 8.1, 8.2, 8.3 | 2.4.0 | 7.* | 7.* |
10.* | 8.1, 8.2, 8.3 | 2.4.0 | 8.* | 8.* |
11.* | 8.2, 8.3, 8.4 | 3.* | ^9.1 | 9.1.4 |
The project is tested on the following operating systems:
- Ubuntu (latest)
- Windows (latest)
The project is tested under different dependency scenarios to ensure robust compatibility:
- Prefer Lowest: Ensuring compatibility with the oldest versions of dependencies.
- Prefer Stable: Ensuring compatibility with the latest stable versions of dependencies.
You can install the package via composer:
composer require tvup/laravel-fejlvarp
Default route to list of incidents will be http://your-url.top/incidents
Important! Make sure to protect this route with (admin) authentication
You can enjoy the convenience of letteing the package install itsleft
php artisan fejlvarp:install
It will also ask you if you want to create (migrate) the table that will be storing the incidents
Instead of doing the above, or just if you are curious, you publish the files manually by doing the following:
You can publish and run the migrations with:
php artisan vendor:publish --tag="fejlvarp-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="fejlvarp-config"
This is the contents of the published config file:
return [
'ipstack' => ['access_key' => env('INCIDENT_MANAGER_IPSTACK_ACCESS_KEY')],
'pushover' => [
'userkey' => env('INCIDENT_MANAGER_PUSHOVER_USER_KEY'),
'apitoken' => env('INCIDENT_MANAGER_PUSHOVER_API_TOKEN'),
],
'slack' => [
'webhook_url' => env('INCIDENT_MANAGER_SLACK_WEBHOOK_URL'),
],
'mail_recipient' => env('INCIDENT_MANAGER_EMAIL_RECIPIENT'),
];
ipstack is used to get info about ip-addresses - you can retrieve an access key here: https://ipstack.com/signup/free Results from ipstack are cached, so it won't drain the free lookups right away.
Pushover/slack/mail is used to inform about new og reopened incidents
Optionally, you can publish the views using
php artisan vendor:publish --tag="fejlvarp-views"
You can replace your exception-handler Replace
php artisan vendor:publish --tag=fejlvarp-provider
remember to make sure that the serivce-provider is correctly installed
You can have other applications report to the one you install it on, get inspiration from /src/Exceptions/LaravelFejlvarpExceptionHandler.php
$hash = config('app.name')
. $exception->getMessage()
. preg_replace('~revisions/[0-9]{14}/~', '--', $exception->getFile())
. $exception->getLine();
$user = request()->user();
$data = [
'hash' => md5($hash),
'subject' => $exception->getMessage() ? $exception->getMessage() : 'Subject is empty',
'data' => json_encode([
'application' => config('app.name'),
'error' => [
'type' => get_class($exception),
'message' => $exception->getMessage(),
'code' => $exception->getCode(),
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'trace' => $exception->getTraceAsString(),
],
'environment' => [
'GET' => $_GET ?: null,
'POST' => $_POST ?: null,
'SERVER' => $_SERVER ?: null,
'SESSION' => request()->hasSession() ? request()->session()->all() : null,
],
'application_data' => $user ? [
'user' => $user->toArray(),
] : null,
'queries' => app(Listener::class)->queries(),
], JSON_THROW_ON_ERROR),
];
$request = Request::create(
'/api/incidents',
'POST',
$data,
[],
[],
['CONTENT_TYPE'=>'application/x-www-form-urlencoded']
);
app()->handle($request);
composer test
These instructions apply to your laravel application where laravel-fejlvarp is installed as a package
- Add a volume to your docker-compose.yml
- '../local-fejlvarp-folder-relative-to-laravel-folder:/var/www/packages/laravel-fejlvarp'
(right below these lines)
volumes:
- '.:/var/www/html'
- Add repository to composer
{
"type": "path",
"url": "../packages/laravel-fejlvarp",
"symlink": true
}
- Use local package
"tvup/laravel-fejlvarp": "@dev"
sail composer update tvup/laravel-fejlvarp
Now you don't need to run composer update each time you change something in the package. (Remember to set back yml- and composer-file before pushing anything)
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.