tvup/laravel-fejlvarp 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tvup/laravel-fejlvarp

Composer 安装命令:

composer require tvup/laravel-fejlvarp

包简介

Simple incident logger for Laravel

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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

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

Laravel Version PHP Versions Required larastan/larastan Required orchestra/testbench Required orchestra/testbench-core
11.* 8.3, 8.4 3.* ^9.1 9.1.4
12.* 8.3, 8.4 3.* ^10.0 10.0.0
13.* 8.3, 8.4, 8.5 3.* ^11.0 11.0.0

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 letting the package install itself.

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 service-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();
        $isConsole = app()->runningInConsole();
        $user = $isConsole ? null : 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' => (!$isConsole && 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);

Updating

When upgrading the package via Composer:

composer update tvup/laravel-fejlvarp
php artisan vendor:publish --tag="fejlvarp-assets" --force

What happens automatically

  • Database migrations registered via runsMigrations() are detected by package discovery — new schema is applied next time php artisan migrate runs. No manual vendor:publish --tag="fejlvarp-migrations" needed unless you want a local copy to edit.

What you must re-run manually

  • Assets: re-run php artisan vendor:publish --tag="fejlvarp-assets" --force after every package update so the published public/vendor/fejlvarp/app.css matches the new package version. Skipping this step leaves stale CSS in place — the dashboard still loads but may render incorrectly. (See #73 for a planned change that removes this step.)
  • Views (only if you forked them): re-publish with --force to take new package changes — but this overwrites your local edits. Diff first: php artisan vendor:publish --tag="fejlvarp-views" writes to resources/views/vendor/fejlvarp/.
  • Config (only if you customised it): the published config/fejlvarp.php is never overwritten without --force. New config keys added in package updates won't appear until you re-publish manually or merge them in by hand.

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.

tvup/laravel-fejlvarp 适用场景与选型建议

tvup/laravel-fejlvarp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.02k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 03 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「laravelfejlvarp」 「laravel-fejlvarp」 「fejlvarp」 「troelskn」 「tvup」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 tvup/laravel-fejlvarp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tvup/laravel-fejlvarp 我们能提供哪些服务?
定制开发 / 二次开发

基于 tvup/laravel-fejlvarp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10.02k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-13