定制 mamitech/tikus 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

mamitech/tikus

最新稳定版本:v4.0.0

Composer 安装命令:

composer create-project mamitech/tikus

包简介

An abstract layer for remote error reporting

README 文档

README

Add Tikus to report your errors to remote error reporting systems such as Bugsnag and Sentry.

This library supports PHP 7.4+.

Installation

Merge this into your composer.json

  ...
  "require": {
    "mamitech/tikus": "^1.0"
  }
  ...
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/mamitech/tikus.git"
    }
  ],
  ...

Run the command below:

composer update mamikos/tikus

Register tikus service provider in providers array in config/app.php before your AppServiceProvider::class:

'providers' => [
    // ...
    Mamikos\Tikus\Facades\TikusFacade::class,
    // ...
],

Register an alias in config/app.php:

'aliases' => [
    // ...
    'Tikus' => Mamikos\Tikus\Facades\TikusFacade::class,
],

Put this code in report method of app/Exceptions/Handler.php

use Tikus;

...

public function report(Exception $exception)
{
    if ($this->shouldReport($exception)) {
        Tikus::reportException($exception);
    }
    parent::report($exception);
}

To use the configured Bugsnag client, import an alias each time:

use Tikus;

Tikus::reportException($e);

Basic configuration

Configure your Bugsnag or Sentry keys in your .env file:

BUGSNAG_API_KEY=your-api-key-here

SENTRY_ENVIRONMENT="${APP_ENV}"
SENTRY_LARAVEL_DSN=your-sentry-dsn

Methods

reportException(Throwable $throwable, Array $metadata = [])

  • throwable: Any Throwable, Any Exception
  • metadata: metadata in array

Usage

use Tikus;
...
catch (Exception $e)
{
  Tikus::reportException($e);
}
Tikus::reportException(new Exception('Data not found'), [
  'data_id': $data->id
]);

reportError($name, $message, Array $metadata = [])

  • name: error type
  • message: error message
  • metadata: metadata in array

Usage

use Tikus;

Tikus::reportError('Info', 'Data is expired');

Tikus::reportError('Info', 'Data is expired', ['expired_at': '2022-07-01 12:59:00']);

// supports nested array
Tikus::reportError('Info', 'My wishlist is', [
  'wishlist': [
    'game': 'overwatch 2',
    'movie': 'topgun: maverick'
  ]
]);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固