esportscz/sentry 问题修复 & 功能扩展

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

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

esportscz/sentry

Composer 安装命令:

composer require esportscz/sentry

包简介

Opinionated Sentry bootstrap for PHP apps, CLI scripts, workers & Nette framework - consistent tags, async flush, Tracy bridge with debug panel, env-based config.

README 文档

README

Opinionated Sentry bootstrap for plain PHP apps, legacy codebases, CLI scripts, cron jobs, workers, and Nette Framework applications.

If DSN is missing or Sentry is disabled, initialization becomes a safe no-op.

What This Package Provides

  • One unified Bootstrap::init() for web + CLI (non-Nette).
  • Common, consistent tags and metadata (service, project, stack, PHP info, git commit, memory limit).
  • Non-blocking async flush by default - on PHP-FPM the HTTP response is sent before Sentry flushes, so errors never add latency to the user-facing request.
  • Configuration via environment variables, with optional per-key overrides in code.
  • Safe context_provider hook - never blocks reporting if it throws.
  • flush() helper for short-lived processes (CLI jobs, cron, workers).
  • Nette Framework integration - DI extension, Tracy bridge, presenter/user/session enrichment, performance monitoring.
  • Tracy Bar panel - real-time Sentry status, configuration overview, and captured events in the Tracy debug bar. Fully configurable via neon.

Installation

composer require esportscz/sentry

Quick Start

Plain PHP

use eSportsCZ\Sentry\Bootstrap;

Bootstrap::init([
    'service' => 'my-service', // treat as required
    'project' => 'my-project',
    'stack'   => 'php',
]);

Nette

extensions:
    sentry: eSportsCZ\Sentry\Nette\SentryExtension

sentry:
    dsn: %env.SENTRY_DSN%
    service: my-service
    project: my-project
    stack: php

No PHP bootstrap changes needed - the extension handles initialization automatically.

Documentation

  • Configuration Reference - all config keys, env vars, defaults, automatic tags
  • Nette Integration - DI extension, Tracy bridge, Application/Security/Session integrations, performance monitoring
  • Helper Methods - setUser, tag, flush, configureScope, context_provider
  • Troubleshooting - common issues, server saturation, timeout tuning
  • Examples - full implementation examples for web, CLI, Nette, and worker

Requirements

  • PHP ^7.2 || ^8.0 (tested up to PHP 8.4)
  • sentry/sentry ^4.0

Nette integration requires PHP ^8.1 and nette/di ^3.2.

Versioning (SemVer)

  • MAJOR - breaking API changes and/or a PHP version bump
  • MINOR - backward-compatible features
  • PATCH - backward-compatible bug fixes

See CHANGELOG.md for a full history of changes.

Contributing

Anyone can open a Pull Request. Please tag @michalpospiech as reviewer.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固