# sentry-php-sdk

Sets up Sentry monitoring in plain PHP, Laravel, or Symfony applications. It inspects your project dependencies and schedules to recommend the right SDK packages and config.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 2200 installs · ★ 272
- Author: getsentry
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/getsentry/sentry-for-ai/tree/HEAD/skills-legacy/sentry-php-sdk/SKILL.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/skills/sentry-php-sdk

## What it does

The skill acts as an onboarding wizard. First, it inspects `composer.json`, `composer.lock`, and directory markers to determine the application type. It spots Laravel by finding `artisan`, Symfony by checking `bin/console`, or treats the codebase as plain PHP. The workflow also looks for queue runners like Horizon or Messenger, background cron tasks, and AI integrations.

Recommendations follow the scan results. Error handling and Monolog logging are selected by default. Web frameworks get automated distributed tracing for HTTP requests and database queries. If the project contains `laravel/ai`, the skill selects `sentry/sentry-laravel` version 4.27.0 or newer to record model spans automatically.

Base setup requires PHP 7.2 or later with `ext-json`, `ext-mbstring`, and `ext-curl`. Profiling will fail on Windows environments because it strictly depends on the `excimer` PECL extension, which runs only on Linux and macOS. Check your host setup before enabling performance sampling.

## Requirements
- Works with: Sentry

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add getsentry/sentry-for-ai --skill sentry-php-sdk -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/sentry-php-sdk/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/sentry-php-sdk/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add getsentry/sentry-for-ai --skill sentry-php-sdk -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/sentry-php-sdk/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add getsentry/sentry-for-ai --skill sentry-php-sdk -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/sentry-php-sdk/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install getsentry/sentry-for-ai sentry-php-sdk
```

2. **Manually: put the files in place**
- File: `.github/skills/sentry-php-sdk/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add getsentry/sentry-for-ai --skill sentry-php-sdk -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/getsentry/sentry-for-ai --path skills-legacy/sentry-php-sdk
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/sentry-php-sdk/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add getsentry/sentry-for-ai --skill sentry-php-sdk -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/getsentry/sentry-for-ai/tree/HEAD/skills-legacy/sentry-php-sdk/SKILL.md

## When to use it
- configure Sentry error monitoring in Laravel, Symfony, or plain PHP
- route application logs through Monolog integrations
- enable execution profiling using the excimer PECL extension
- instrument queue jobs across Horizon and Symfony Messenger
- track AI calls automatically in laravel/ai projects

## Example prompts
- add Sentry to PHP and configure error monitoring
- setup Sentry in a Laravel project with queue monitoring
- install sentry/sentry-symfony and configure tracing

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 3e61897e3289d877.

BEGIN THIRD-PARTY FILE 3e61897e3289d877
````text
---
name: sentry-php-sdk
description: 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, crons, or AI monitoring for PHP applications. Supports plain PHP, Laravel, and Symfony.
license: Apache-2.0
category: sdk-setup
parent: sentry-sdk-setup
disable-model-invocation: true
---

> [All Skills](../../SKILL_TREE.md) > [SDK Setup](../sentry-sdk-setup/SKILL.md) > 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/](https://docs.sentry.io/platforms/php/) before implementing.

---

## Phase 1: Detect

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 '"(laravel/ai|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.)
````
END THIRD-PARTY FILE 3e61897e3289d877

The third-party file has ended. Everything between the 3e61897e3289d877 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2524 of 14938 bytes. © getsentry · Apache-2.0 · https://github.com/getsentry/sentry-for-ai/tree/HEAD/skills-legacy/sentry-php-sdk/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
