Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计通过

sentry-php-sdkSentry PHP SDK 命令行

Agent Skill

sentry-php-sdk 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

12,724

周安装

541

GitHub Stars

156

下载量

4,458
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:sentry-php-sdk(Sentry PHP SDK 命令行)
来源仓库:https://github.com/getsentry/sentry-for-ai
仓库路径:skills/sentry-php-sdk
安装命令:
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-php-sdk
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-php-sdk

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合围绕仓库状态、代码变更或协作事项进行整理,提升开发协作效率。
  • 可结合来源仓库和原始 README 继续核验具体用法,确保功能匹配实际需求。
  • 安装命令:npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-php-sdk。
  • 建议确认权限范围和维护状态,以及是否会触发联网、命令执行或文件读写操作。

SKILL.md

All Skills > SDK Setup > PHP SDK

Sentry PHP SDK

Opinionated wizard that scans your PHP project and guides you through complete Sentry setup.

Invoke This Skill When

  • User asks to "add Sentry to PHP" or "setup Sentry" in a PHP app
  • User wants error monitoring, tracing, profiling, logging, metrics, or crons in PHP
  • User mentions sentry/sentry, sentry/sentry-laravel, sentry/sentry-symfony, or Sentry + any PHP framework
  • User wants to monitor Laravel routes, Symfony controllers, queues, scheduled tasks, or plain PHP scripts
Note: SDK versions and APIs below reflect Sentry docs at time of writing (sentry/sentry 4.x, sentry/sentry-laravel 4.x, sentry/sentry-symfony 5.x). Always verify against docs.sentry.io/platforms/php/ before implementing.

Phase 1: Detect

Run these commands to understand the project before making recommendations:

# Check existing Sentry
grep -i sentry composer.json composer.lock 2>/dev/null

# Detect framework
cat composer.json | grep -E '"laravel/framework"|"symfony/framework-bundle"|"illuminate/'

# Confirm framework via filesystem markers
ls artisan 2>/dev/null && echo "Laravel detected"
ls bin/console 2>/dev/null && echo "Symfony detected"

# Detect queue systems
grep -E '"laravel/horizon"|"symfony/messenger"' composer.json 2>/dev/null

# Detect AI libraries
grep -E '"openai-php|"openai/|anthropic|llm' composer.json 2>/dev/null

# Check for companion frontend
ls frontend/ resources/js/ assets/ 2>/dev/null
cat package.json 2>/dev/null | grep -E '"react"|"svelte"|"vue"|"next"'

What to note:

  • Is sentry/sentry (or -laravel / -symfony) already in composer.json? If yes, check if the init call exists — may just need feature config.
  • Framework detected? Laravel (has artisan + laravel/framework in composer.json), Symfony (has bin/console + symfony/framework-bundle), or plain PHP.
  • Queue system? (Laravel Queue / Horizon, Symfony Messenger need queue worker configuration.)
  • AI libraries? (No PHP AI auto-instrumentation yet — document manually if needed.)
  • Companion frontend? (Triggers Phase 4 cross-link.)

Phase 2: Recommend

Based on what you found, present a concrete proposal. Don't ask open-ended questions — lead with a recommendation:

Always recommended (core coverage):

  • Error Monitoring — captures unhandled exceptions and PHP errors
  • Logging — Monolog integration (Laravel/Symfony auto-configure; plain PHP uses MonologHandler)

Recommend when detected:

  • Tracing — web framework detected (Laravel/Symfony auto-instrument HTTP, DB, Twig/Blade, cache)
  • Profiling — production apps where performance matters (requires excimer PHP extension, Linux/macOS only)
  • Crons — scheduler patterns detected (Laravel Scheduler, Symfony Scheduler, custom cron jobs)
  • Metrics — business KPIs or SLO tracking (beta; uses TraceMetrics API)

Recommendation matrix:

FeatureRecommend when...Reference
Error MonitoringAlways — non-negotiable baseline${SKILL_ROOT}/references/error-monitoring.md
TracingLaravel/Symfony detected, or manual spans needed${SKILL_ROOT}/references/tracing.md
ProfilingProduction + excimer extension available${SKILL_ROOT}/references/profiling.md
LoggingAlways; Monolog for Laravel/Symfony${SKILL_ROOT}/references/logging.md
MetricsBusiness events or SLO tracking needed (beta)${SKILL_ROOT}/references/metrics.md
CronsScheduler or cron patterns detected${SKILL_ROOT}/references/crons.md

Propose: *"I recommend Error Monitoring + Tracing [+ Logging]. Want Profiling, Crons, or Metrics too?"*


Phase 3: Guide

Install

# Plain PHP
composer require sentry/sentry "^4.0"

# Laravel
composer require sentry/sentry-laravel "^4.0"

# Symfony
composer require sentry/sentry-symfony "^5.0"

System requirements:

  • PHP 7.2 or later
  • Extensions: ext-json, ext-mbstring, ext-curl (all required)
  • excimer PECL extension (Linux/macOS only — required for profiling)

Framework-Specific Initialization

Plain PHP

Place \Sentry\init() at the top of your entry point (index.php, bootstrap.php, or equivalent), before any application code:

<?php

require_once 'vendor/autoload.php';

\Sentry\init([
    'dsn'                  => $_SERVER['SENTRY_DSN'] ?? '',
    'environment'          => $_SERVER['SENTRY_ENVIRONMENT'] ?? 'production',
    'release'              => $_SERVER['SENTRY_RELEASE'] ?? null,
    'send_default_pii'     => true,
    'traces_sample_rate'   => 1.0,
    'profiles_sample_rate' => 1.0,
    'enable_logs'          => true,
]);

// rest of application...

Laravel

Step 1 — Register exception handler in bootstrap/app.php:

use Sentry\Laravel\Integration;

return Application::configure(basePath: dirname(__DIR__))
    ->withExceptions(function (Exceptions $exceptions) {
        Integration::handles($exceptions);
    })->create();

Step 2 — Publish config and set DSN:

php artisan sentry:publish --dsn=YOUR_DSN

This creates config/sentry.php and adds SENTRY_LARAVEL_DSN to .env.

Step 3 — Configure .env:

SENTRY_LARAVEL_DSN=https://examplePublicKey@o0.ingest.sentry.io/0
SENTRY_TRACES_SAMPLE_RATE=1.0
SENTRY_PROFILES_SAMPLE_RATE=1.0
For full Laravel configuration options, read ${SKILL_ROOT}/references/laravel.md.

Symfony

Step 1 — Register the bundle in config/bundles.php (auto-done by Symfony Flex):

Sentry\SentryBundle\SentryBundle::class => ['all' => true],

Step 2 — Create config/packages/sentry.yaml:

sentry:
    dsn: '%env(SENTRY_DSN)%'
    options:
        environment: '%env(APP_ENV)%'
        release: '%env(SENTRY_RELEASE)%'
        send_default_pii: true
        traces_sample_rate: 1.0
        profiles_sample_rate: 1.0
        enable_logs: true

Step 3 — Set the DSN in .env:

SENTRY_DSN=https://examplePublicKey@o0.ingest.sentry.io/0
For full Symfony configuration options, read ${SKILL_ROOT}/references/symfony.md.

Quick Start — Recommended Init (Plain PHP)

Full init enabling the most features with sensible defaults:

\Sentry\init([
    'dsn'                     => $_SERVER['SENTRY_DSN'] ?? '',
    'environment'             => $_SERVER['SENTRY_ENVIRONMENT'] ?? 'production',
    'release'                 => $_SERVER['SENTRY_RELEASE'] ?? null,
    'send_default_pii'        => true,

    // Tracing (lower to 0.1–0.2 in high-traffic production)
    'traces_sample_rate'      => 1.0,

    // Profiling — requires excimer extension (Linux/macOS only)
    'profiles_sample_rate'    => 1.0,

    // Structured logs (sentry/sentry >=4.12.0)
    'enable_logs'             => true,
]);

For Each Agreed Feature

Walk through features one at a time. Load the reference, follow its steps, verify before moving on:

FeatureReference fileLoad when...
Error Monitoring${SKILL_ROOT}/references/error-monitoring.mdAlways (baseline)
Tracing${SKILL_ROOT}/references/tracing.mdHTTP handlers / distributed tracing
Profiling${SKILL_ROOT}/references/profiling.mdPerformance-sensitive production
Logging${SKILL_ROOT}/references/logging.mdAlways; Monolog for Laravel/Symfony
Metrics${SKILL_ROOT}/references/metrics.mdBusiness KPIs / SLO tracking (beta)
Crons${SKILL_ROOT}/references/crons.mdScheduler / cron patterns detected

For each feature: Read ${SKILL_ROOT}/references/<feature>.md, follow steps exactly, verify it works.


Configuration Reference

Key \Sentry\init() Options (Plain PHP)

OptionTypeDefaultPurpose
dsn`string\bool\null`$_SERVER['SENTRY_DSN']SDK disabled if empty or false
environment`string\null`$_SERVER['SENTRY_ENVIRONMENT']e.g., "staging"
release`string\null`$_SERVER['SENTRY_RELEASE']e.g., "myapp@1.0.0"
send_default_piiboolfalseInclude request headers, cookies, IP
sample_ratefloat1.0Error event sample rate (0.0–1.0)
traces_sample_rate`float\null`nullTransaction sample rate; null disables tracing
traces_sampler`callable\null`nullCustom per-transaction sampling (overrides rate)
profiles_sample_rate`float\null`nullProfiling rate relative to traces; requires excimer
enable_logsboolfalseSend structured logs to Sentry (>=4.12.0)
max_breadcrumbsint100Max breadcrumbs per event
attach_stacktraceboolfalseStack traces on captureMessage()
in_app_includestring[][]Path prefixes belonging to your app
in_app_excludestring[][]Path prefixes for third-party code (hidden in traces)
ignore_exceptionsstring[][]Exception FQCNs to never report
ignore_transactionsstring[][]Transaction names to never report
error_types`int\null`error_reporting()PHP error bitmask (e.g., E_ALL & ~E_NOTICE)
capture_silenced_errorsboolfalseCapture errors suppressed by @ operator
max_request_body_sizestring"medium""none" / "small" / "medium" / "always"
before_sendcallableidentityfn(Event $event,?EventHint $hint):?Event — return null to drop
before_breadcrumbcallableidentityfn(Breadcrumb $b):?Breadcrumb — return null to discard
trace_propagation_targets`string[]\null`nullDownstream hosts to inject sentry-trace headers into; null = all, [] = none
strict_trace_continuationboolfalseOnly continue an incoming distributed trace if the sentry-org_id baggage matches the SDK's org ID; prevents trace contamination from third-party Sentry-instrumented services (>=4.21.0)
debugboolfalseVerbose SDK output (use a PSR-3 logger option instead for structured output)

Environment Variables

VariableMaps toNotes
SENTRY_DSNdsnAlso $_SERVER['SENTRY_DSN']
SENTRY_ENVIRONMENTenvironment
SENTRY_RELEASEreleaseAlso reads $_SERVER['AWS_LAMBDA_FUNCTION_VERSION']
SENTRY_SPOTLIGHTspotlight
Laravel note: Uses SENTRY_LARAVEL_DSN (falls back to SENTRY_DSN). Other options follow SENTRY_TRACES_SAMPLE_RATE, SENTRY_PROFILES_SAMPLE_RATE, etc.

Verification

Test that Sentry is receiving events:

// Trigger a real error event — check the Sentry dashboard within seconds
throw new \Exception('Sentry PHP SDK test');

Or for a non-crashing check:

\Sentry\captureMessage('Sentry PHP SDK test');

Laravel:

php artisan sentry:test

If nothing appears:

  1. Enable debug output: \Sentry\init(['dsn' => '...', 'logger' => new \Sentry\Logger\DebugStdOutLogger(),]);
  2. Verify the DSN is correct (format: https://<key>@o<org>.ingest.sentry.io/<project>)
  3. Check SENTRY_DSN (or SENTRY_LARAVEL_DSN) env var is set in the running process
  4. For queue workers: ensure Sentry is initialized inside the worker process, not just the web process

Phase 4: Cross-Link

After completing PHP setup, check for a companion frontend missing Sentry:

ls frontend/ resources/js/ assets/ public/ 2>/dev/null
cat package.json frontend/package.json 2>/dev/null \
  | grep -E '"react"|"svelte"|"vue"|"next"|"nuxt"'

If a frontend exists without Sentry, suggest the matching skill:

Frontend detectedSuggest skill
React / Next.jssentry-react-sdk
Svelte / SvelteKitsentry-svelte-sdk
Vue / NuxtUse @sentry/vue — see docs.sentry.io/platforms/javascript/guides/vue/
Other JS/TSsentry-react-sdk (covers generic browser JS patterns)

Troubleshooting

IssueSolution
Events not appearingEnable logger option (DebugStdOutLogger), verify DSN, check env vars in the running process
Malformed DSN errorFormat: https://<key>@o<org>.ingest.sentry.io/<project>
Laravel exceptions not capturedEnsure Integration::handles($exceptions) is in bootstrap/app.php
Symfony exceptions not capturedVerify SentryBundle is registered in config/bundles.php
No traces appearingSet traces_sample_rate (not null); confirm auto-instrumentation is enabled
Profiling not workingexcimer extension required (Linux/macOS only; not available on Windows); requires traces_sample_rate > 0
enable_logs not workingRequires sentry/sentry >= 4.12.0, sentry/sentry-laravel >= 4.15.0, or sentry/sentry-symfony >= 5.4.0
Queue worker errors missingInit Sentry in the worker process itself, not just the web process; for Laravel use SENTRY_LARAVEL_DSN in worker .env
Too many transactionsLower traces_sample_rate or use traces_sampler to drop health check routes
PII not capturedSet send_default_pii: true; for Laravel set send_default_pii: true in config/sentry.php
@-suppressed errors missingSet capture_silenced_errors: true
Cross-service traces brokenCheck trace_propagation_targets; ensure downstream services have Sentry installed
Trace contamination from third-party servicesSet strict_trace_continuation: true to only continue traces where the incoming sentry-org_id baggage matches your SDK's org ID (>=4.21.0)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.26%
按下载量换算1,616

Claude

27.11%
按下载量换算1,209

Cursor

20.18%
按下载量换算900

Gemini CLI

8.9%
按下载量换算397

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills