Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Full Sentry SDK setup for PHP. Use when asked to \"add Sentry to PHP\", \"install sentry/sentry\", \"setup Sentry in PHP\", or configure error monitoring, tracing, profiling, logging, metrics, or crons for PHP applications. Supports plain PHP, Laravel, and Symfony.
.claude/skills/kunanonj-cursor-plugin-sentry-sentry-php-sdk/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 183% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 216% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 63% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 8% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 47% | 0% |
> All Skills > SDK Setup > PHP SDK
Opinionated wizard that scans your PHP project and guides you through complete Sentry setup.
sentry/sentry, sentry/sentry-laravel, sentry/sentry-symfony, or Sentry + any PHP framework> 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.
Run these commands to understand the project before making recommendations:
bash# 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:
sentry/sentry (or -laravel / -symfony) already in composer.json? If yes, check if the init call exists — may just need feature config.artisan + laravel/framework in composer.json), Symfony (has bin/console + symfony/framework-bundle), or plain PHP.Based on what you found, present a concrete proposal. Don't ask open-ended questions — lead with a recommendation:
Always recommended (core coverage):
MonologHandler)Recommend when detected:
excimer PHP extension, Linux/macOS only)TraceMetrics API)Recommendation matrix:
| Feature | Recommend when... | Reference | |---------|------------------|-----------| | Error Monitoring | Always — non-negotiable baseline | ${SKILL_ROOT}/references/error-monitoring.md | | Tracing | Laravel/Symfony detected, or manual spans needed | ${SKILL_ROOT}/references/tracing.md | | Profiling | Production + excimer extension available | ${SKILL_ROOT}/references/profiling.md | | Logging | Always; Monolog for Laravel/Symfony | ${SKILL_ROOT}/references/logging.md | | Metrics | Business events or SLO tracking needed | ${SKILL_ROOT}/references/metrics.md | | Crons | Scheduler or cron patterns detected | ${SKILL_ROOT}/references/crons.md |
Propose: "I recommend Error Monitoring + Tracing [+ Logging]. Want Profiling, Crons, or Metrics too?"
bash# 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:
ext-json, ext-mbstring, ext-curl (all required)excimer PECL extension (Linux/macOS only — required for profiling)Place \Sentry\init() at the top of your entry point (index.php, bootstrap.php, or equivalent), before any application code:
php<?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...
Step 1 — Register exception handler in bootstrap/app.php:
phpuse Sentry\Laravel\Integration; return Application::configure(basePath: dirname(__DIR__)) ->withExceptions(function (Exceptions $exceptions) { Integration::handles($exceptions); })->create();
Step 2 — Publish config and set DSN:
bashphp artisan sentry:publish --dsn=YOUR_DSN
This creates config/sentry.php and adds SENTRY_LARAVEL_DSN to .env.
Step 3 — Configure .env:
iniSENTRY_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.
Step 1 — Register the bundle in config/bundles.php (auto-done by Symfony Flex):
phpSentry\SentryBundle\SentryBundle::class => ['all' => true],
Step 2 — Create config/packages/sentry.yaml:
yamlsentry: 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:
iniSENTRY_DSN=https://examplePublicKey@o0.ingest.sentry.io/0
> For full Symfony configuration options, read ${SKILL_ROOT}/references/symfony.md.
Full init enabling the most features with sensible defaults:
php\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, ]);
Walk through features one at a time. Load the reference, follow its steps, verify before moving on:
| Feature | Reference file | Load when... | |---------|---------------|-------------| | Error Monitoring | ${SKILL_ROOT}/references/error-monitoring.md | Always (baseline) | | Tracing | ${SKILL_ROOT}/references/tracing.md | HTTP handlers / distributed tracing | | Profiling | ${SKILL_ROOT}/references/profiling.md | Performance-sensitive production | | Logging | ${SKILL_ROOT}/references/logging.md | Always; Monolog for Laravel/Symfony | | Metrics | ${SKILL_ROOT}/references/metrics.md | Business KPIs / SLO tracking | | Crons | ${SKILL_ROOT}/references/crons.md | Scheduler / cron patterns detected |
For each feature: Read ${SKILL_ROOT}/references/<feature>.md, follow steps exactly, verify it works.
\Sentry\init() Options (Plain PHP)| Option | Type | Default | Purpose | |--------|------|---------|---------| | 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_pii | bool | false | Include request headers, cookies, IP | | sample_rate | float | 1.0 | Error event sample rate (0.0–1.0) | | traces_sample_rate | float\|null | null | Transaction sample rate; null disables tracing | | traces_sampler | callable\|null | null | Custom per-transaction sampling (overrides rate) | | profiles_sample_rate | float\|null | null | Profiling rate relative to traces; requires excimer | | enable_logs | bool | false | Send structured logs to Sentry (>=4.12.0) | | max_breadcrumbs | int | 100 | Max breadcrumbs per event | | attach_stacktrace | bool | false | Stack traces on captureMessage() | | in_app_include | string[] | [] | Path prefixes belonging to your app | | in_app_exclude | string[] | [] | Path prefixes for third-party code (hidden in traces) | | ignore_exceptions | string[] | [] | Exception FQCNs to never report | | ignore_transactions | string[] | [] | Transaction names to never report | | error_types | int\|null | error_reporting() | PHP error bitmask (e.g., E_ALL & ~E_NOTICE) | | capture_silenced_errors | bool | false | Capture errors suppressed by @ operator | | max_request_body_size | string | "medium" | "none" / "small" / "medium" / "always" | | before_send | callable | identity | fn(Event $event, ?EventHint $hint): ?Event — return null to drop | | before_breadcrumb | callable | identity | fn(Breadcrumb $b): ?Breadcrumb — return null to discard | | trace_propagation_targets | string[]\|null | null | Downstream hosts to inject sentry-trace headers into; null = all, [] = none | | strict_trace_continuation | bool | false | Only 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) | | debug | bool | false | Verbose SDK output (use a PSR-3 logger option instead for structured output) |
| Variable | Maps to | Notes | |----------|---------|-------| | SENTRY_DSN | dsn | Also $_SERVER['SENTRY_DSN'] | | SENTRY_ENVIRONMENT | environment | | | SENTRY_RELEASE | release | Also reads $_SERVER['AWS_LAMBDA_FUNCTION_VERSION'] | | SENTRY_SPOTLIGHT | spotlight | |
> Laravel note: Uses SENTRY_LARAVEL_DSN (falls back to SENTRY_DSN). Other options follow SENTRY_TRACES_SAMPLE_RATE, SENTRY_PROFILES_SAMPLE_RATE, etc.
Test that Sentry is receiving events:
php// Trigger a real error event — check the Sentry dashboard within seconds throw new \Exception('Sentry PHP SDK test');
Or for a non-crashing check:
php\Sentry\captureMessage('Sentry PHP SDK test');
Laravel:
bashphp artisan sentry:test
If nothing appears:
php \Sentry\init([ 'dsn' => '...', 'logger' => new \Sentry\Logger\DebugStdOutLogger(), ]);
https://<key>@o<org>.ingest.sentry.io/<project>)SENTRY_DSN (or SENTRY_LARAVEL_DSN) env var is set in the running processAfter completing PHP setup, check for a companion frontend missing Sentry:
bashls 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 detected | Suggest skill | |-------------------|--------------| | React / Next.js | sentry-react-sdk | | Svelte / SvelteKit | sentry-svelte-sdk | | Vue / Nuxt | Use @sentry/vue — see docs.sentry.io/platforms/javascript/guides/vue/ | | Other JS/TS | sentry-react-sdk (covers generic browser JS patterns) |
| Issue | Solution | |-------|----------| | Events not appearing | Enable logger option (DebugStdOutLogger), verify DSN, check env vars in the running process | | Malformed DSN error | Format: https://<key>@o<org>.ingest.sentry.io/<project> | | Laravel exceptions not captured | Ensure Integration::handles($exceptions) is in bootstrap/app.php | | Symfony exceptions not captured | Verify SentryBundle is registered in config/bundles.php | | No traces appearing | Set traces_sample_rate (not null); confirm auto-instrumentation is enabled | | Profiling not working | excimer extension required (Linux/macOS only; not available on Windows); requires traces_sample_rate > 0 | | enable_logs not working | Requires sentry/sentry >= 4.12.0, sentry/sentry-laravel >= 4.15.0, or sentry/sentry-symfony >= 5.4.0 | | Queue worker errors missing | Init Sentry in the worker process itself, not just the web process; for Laravel use SENTRY_LARAVEL_DSN in worker .env | | Too many transactions | Lower traces_sample_rate or use traces_sampler to drop health check routes | | PII not captured | Set send_default_pii: true; for Laravel set send_default_pii: true in config/sentry.php | | @-suppressed errors missing | Set capture_silenced_errors: true | | Cross-service traces broken | Check trace_propagation_targets; ensure downstream services have Sentry installed | | Trace contamination from third-party services | Set strict_trace_continuation: true to only continue traces where the incoming sentry-org_id baggage matches your SDK's org ID (>=4.21.0) |
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-07 | pass→pass | 8,897 | 5,670 | -36% | 1 | 1 | 0% | 1,471 | 5,194 | +253% | 0 | 0 | — |
case-01 | fail→fail | 19,078 | 4,722 | -75% | 1 | 1 | 0% | 3,994 | 4,342 | +9% | 0 | 0 | — |
case-02 | fail→fail | 15,342 | 6,666 | -57% | 1 | 1 | 0% | 3,251 | 4,473 | +38% | 0 | 0 | — |
case-03 | fail→fail | 16,092 | 5,467 | -66% | 1 | 1 | 0% | 2,918 | 4,417 | +51% | 0 | 0 | — |
case-04 | fail→pass | 8,732 | 4,177 | -52% | 1 | 1 | 0% | 1,775 | 5,030 | +183% | 0 | 0 | — |
case-05 | fail→pass | 7,801 | 4,934 | -37% | 1 | 1 | 0% | 1,635 | 5,163 | +216% | 0 | 0 | — |
case-06 | fail→pass | 15,337 | 3,076 | -80% | 1 | 1 | 0% | 2,906 | 4,736 | +63% | 0 | 0 | — |
case-08 | pass→pass | 8,881 | 5,100 | -43% | 1 | 1 | 0% | 1,722 | 5,184 | +201% | 0 | 0 | — |
case-09 | fail→pass | 24,912 | 3,925 | -84% | 1 | 1 | 0% | 4,482 | 4,859 | +8% | 0 | 0 | — |
case-10 | fail→pass | 18,073 | 3,238 | -82% | 1 | 1 | 0% | 3,259 | 4,802 | +47% | 0 | 0 | — |
case-11 | pass→pass | 2,128 | 2,641 | +24% | 1 | 1 | 0% | 364 | 4,513 | +1140% | 0 | 0 | — |
case-12 | fail→pass | 10,809 | 4,555 | -58% | 1 | 1 | 0% | 1,991 | 4,920 | +147% | 0 | 0 | — |
case-13 | pass→pass | 7,083 | 2,720 | -62% | 1 | 1 | 0% | 1,379 | 4,664 | +238% | 0 | 0 | — |
case-14 | fail→pass | 13,345 | 10,383 | -22% | 1 | 1 | 0% | 2,328 | 5,893 | +153% | 0 | 0 | — |
case-15 | pass→pass | 7,076 | 6,262 | -12% | 1 | 1 | 0% | 1,356 | 5,362 | +295% | 0 | 0 | — |
case-16 | pass→pass | 4,622 | 3,305 | -28% | 1 | 1 | 0% | 832 | 4,746 | +470% | 0 | 0 | — |
case-17 | pass→pass | 9,981 | 3,998 | -60% | 1 | 1 | 0% | 1,852 | 4,792 | +159% | 0 | 0 | — |
case-18 | pass→pass | 9,311 | 7,543 | -19% | 1 | 1 | 0% | 1,680 | 5,417 | +222% | 0 | 0 | — |
case-19 | pass→pass | 1,743 | 1,637 | -6% | 1 | 1 | 0% | 331 | 4,426 | +1237% | 0 | 0 | — |
case-20 | pass→pass | 11,516 | 6,843 | -41% | 1 | 1 | 0% | 2,313 | 5,529 | +139% | 0 | 0 | — |
case-21 | pass→pass | 19,908 | 14,782 | -26% | 1 | 1 | 0% | 3,564 | 6,935 | +95% | 0 | 0 | — |
case-22 | pass→pass | 16,921 | 8,557 | -49% | 1 | 1 | 0% | 3,320 | 5,911 | +78% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 20 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +32 percentage points is the difference between those two pass rates over the 20 comparable cases. 3 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.