tvup / laravel-fejlvarp
Simple incident logger for Laravel
Fund package maintenance!
tvup
Installs: 5 094
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: ^8.0.2
- laravel/framework: ^9.47|^10|^11
- nesbot/carbon: ^2|^3
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- ext-curl: *
- friendsofphp/php-cs-fixer: ^3.35
- larastan/larastan: ^2.4.0
- nunomaduro/collision: ^6|^7|^8
- orchestra/testbench: ^7|^8|^9
- pestphp/pest: ^1.22.1|^2|^3
- pestphp/pest-plugin-laravel: ^1.4|^2|^3
- phpstan/phpstan-phpunit: ^1.3
- phpunit/phpunit: ^9|^10|^11
- spatie/laravel-ray: ^1.33
- dev-master
- v11.1.4
- v11.1.3
- v11.1.2
- v11.1.1
- v11.1.0
- v11.0.0
- v10.2.6
- v10.2.5.10
- v10.2.5.9
- v10.2.5.8
- v10.2.5.7
- v10.2.5.6
- v10.2.5.5
- v10.2.5.4
- v10.2.5.3
- v10.2.5.2
- v10.2.5.1
- v10.2.5
- v9.1.5
- v9.1.4
- v9.1.3
- v9.1.2.x-dev
- v9.1.2
- v9.1.1.x-dev
- v9.1.1
- v9.1.0.x-dev
- v9.1.0
- v9.0.4.x-dev
- v9.0.4
- v9.0.3
- v9.0.2
- v9.0.1
- v9.0.0
- dev-develop
- dev-feature/add-user-data-to-fejlvarp
- dev-feature/display-session-content
- dev-feature/fix-usage-of-hard-coded-time-zone
- dev-feature/update-readme
- dev-feature/re-enable-update-changelog
- dev-feature/check-php-versions-below-8.2
- dev-feature/check-php-version-8.3
- dev-feature/laravels-handler
- dev-feature/allow-laravel-11
- dev-v.9.1.4
- dev-v.9.1.3
This package is auto-updated.
Last update: 2024-10-27 15:55:29 UTC
README
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.
Contributors
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.
Supported Versions
This project supports a range of PHP and Laravel versions, tested across multiple operating systems. Below are the details of the supported versions:
PHP and Laravel Compatibility
Operating Systems
The project is tested on the following operating systems:
- Ubuntu (latest)
- Windows (latest)
Testing Stability
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.
Installation
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);
Testing
composer test
Local development on laravel-fejlvarp through laravel application
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)
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.