hsndmr/cappadocia-viewer-for-laravel 问题修复 & 功能扩展

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

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

hsndmr/cappadocia-viewer-for-laravel

最新稳定版本:1.1.0

Composer 安装命令:

composer require hsndmr/cappadocia-viewer-for-laravel

包简介

Cappadocia Viewer for Laravel

README 文档

README

Cappadocia Viewer for Laravel

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

Installation

Prior to installing this package, ensure that you have already installed Cappadocia Viewer

You can install the package via composer:

composer require hsndmr/cappadocia-viewer-for-laravel --dev

You can publish the config file with:

php artisan vendor:publish --tag="cappadocia-viewer"

This is the contents of the published config file:

return [
    'server_url'    => env('CAPPADOCIA_VIEWER_SERVER_URL', 'http://127.0.0.1:9091'),
    'timeout'       => env('CAPPADOCIA_VIEWER_TIMEOUT', 3),
    'enabled'       => env('CAPPADOCIA_VIEWER_ENABLED', true),
    'watch_logs'    => env('CAPPADOCIA_VIEWER_WATCH_LOGS', true),
    'watch_jobs'    => env('CAPPADOCIA_VIEWER_WATCH_JOBS', false),
    'watch_queries' => env('CAPPADOCIA_VIEWER_WATCH_QUERIES', false),
];

Usage

Showing Queries

You can show queries by using cappadocia helper function.

    cappadocia()->watchQueries();
    User::latest()->first();
    cappadocia()->stopWatchingQueries();
    
    // This query will not be shown in the viewer
    User::first()->first();
Cappadocia Viewer for Laravel

If you want to show all queries, you can add CAPPADOCIA_VIEWER_WATCH_QUERIES=true to your .env file.

Showing Jobs

You can show jobs by using cappadocia helper function.

cappadocia()->watchJobs();
CappadociaViewerJob::dispatchSync('viewer');
cappadocia()->stopWatchingJobs();

// This job will not be shown in the viewer
CappadociaViewerJob::dispatchSync('another viewer');
Cappadocia Viewer for Laravel

If you are utilizing Laravel Horizon, you can insert CAPPADOCIA_VIEWER_WATCH_JOBS=true into your .env file. This will enable you to view all jobs in the viewer

CappadociaViewerJob::dispatch('viewer');

Showing Logs

Logs are shown by default. If you want to disable it, you can add CAPPADOCIA_VIEWER_WATCH_LOGS=false to your .env file.

Log::info('This log will be shown in the viewer');
Cappadocia Viewer for Laravel

Showing Requests

If you want to show requests, you can add CAPPADOCIA_VIEWER_WATCH_REQUESTS=true to your .env file. After that, you can see all requests in the viewer.

Cappadocia Viewer for Laravel

Custom Messages

If you want to show custom messages, you can use cappadocia helper function.

cappadocia('This is custom message')
    ->send([
        'custom' => 'data',
    ]);

cappadocia('This is custom message with Badge')
    ->setBadge('Badge')
    ->send([
        'custom' => 'data',
    ]);
Cappadocia Viewer for Laravel

Disabling Cappadocia Viewer

To disable the Cappadocia Viewer, you can include CAPPADOCIA_VIEWER_ENABLED=false in your .env file. This could be particularly useful if you wish to disable it within a testing environment.

Testing

composer test

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-31