TopGit
GitHub Repo Review

Sentry PHP SDK: Official Error Tracking for PHP

getsentry/sentry-php
STopGit review image for getsentry/sentry-php
Review by Topgit.dev for getsentry/sentry-php, with GitHub repository stats and README context.
Quick verdict

Official Sentry SDK for PHP is the library getsentry maintains to capture and report exceptions from PHP applications to Sentry. Install is one Composer command, and the core API is two calls: init() with a DSN, then captureException() inside a catch block. Reach for it if you send errors to a Sentry project and want the official client over a community wrapper; skip it if you have no Sentry project, since the SDK alone doesn't store anything.

Stars
โ˜… 1.9k
Forks
โ‘‚ 480
Contributors
๐Ÿ‘ฅ 259
Language
PHP
License
MIT
Topic
Backend
Updated
Oct 2026

Understanding the Sentry PHP SDK

Official Sentry SDK for PHP is getsentry's client library for reporting errors and exceptions from a PHP application to Sentry, the hosted (and self-hostable) error-tracking platform. It wraps error capture and API transport behind two functions: \Sentry\init() to configure a DSN, and \Sentry\captureException() to send a caught exception to your Sentry project, so you see what broke and where instead of digging through server logs after the fact.

Core Capabilities for Error Tracking

  • โœ“Two-function core API: \Sentry\init(['dsn' => ...]) to configure, \Sentry\captureException($exception) inside a catch block to report โ€” no framework required to get a first event flowing.
  • โœ“Installed via Composer as the sentry/sentry package, so it drops into any PHP project's existing dependency graph.
  • โœ“Official Symfony and Laravel integrations (sentry-symfony, sentry-laravel) maintained by the Sentry team itself, not bolted on by the community.
  • โœ“A long tail of community-maintained integrations spanning four SDK generations (1.x through 4.x), covering CMS and framework targets Sentry itself doesn't maintain, including Drupal, WordPress, Magento 2, Joomla!, Neos, TYPO3, Zend Framework, Yii2, Silverstripe, CakePHP, October CMS, OXID eShop, and OpenCart.
  • โœ“MIT-licensed, so there are no license terms restricting how you embed it in a commercial codebase.
  • โœ“A public bug tracker on GitHub and a Sentry Community Discord server for setup help, per the README.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history โ†—

Installing the SDK with Composer

Install the SDK with Composer: `composer require sentry/sentry`. That pulls in the sentry/sentry package and its dependencies; the README doesn't list a minimum PHP version or other prerequisites beyond having Composer available, so check the package's own composer.json if you need to confirm compatibility with your PHP version.

Basic Configuration and Error Capture

Initialize Official Sentry SDK for PHP as early as possible in your application's bootstrap with `\Sentry\init(['dsn' => '<your DSN>'])`, using the DSN value your Sentry project gives you. From there, wrap risky code in a try/catch block and call `\Sentry\captureException($exception)` inside the catch to send that exception to Sentry. The README's own example follows exactly that shape โ€” throw, catch, and report โ€” with nothing more elaborate than two function calls needed to get a first event into your Sentry project.

Integrating with PHP Frameworks and CMS

  • โ€ขSymfony or Laravel apps, via the official sentry-symfony or sentry-laravel packages that wrap this core SDK with framework-specific error handlers.
  • โ€ขWordPress or Drupal sites, using the community-maintained wp-sentry-integration plugin or the Drupal raven project, both built on this SDK.
  • โ€ขMagento 2 stores, through either of two community integrations (from JustBetter or Mygento) that plug this SDK into Magento's own error handling.
  • โ€ขOlder or niche PHP stacks โ€” Zend Framework, Yii2, Silverstripe, CakePHP, October CMS, TYPO3, Joomla!, Neos, or OXID eShop โ€” each with its own community-built integration tied to a specific SDK generation (the README separates these by SDK 1.x through 4.x compatibility).
  • โ€ขAny custom PHP codebase with no framework at all, since the two core functions (init and captureException) work standalone.

Strengths

  • โœ“Two-function core (init, captureException) means a first error report needs no framework glue code โ€” you can wire it into pure PHP.
  • โœ“Official, Sentry-team-maintained integrations exist for both Symfony and Laravel, not just community forks.
  • โœ“Composer install (`composer require sentry/sentry`) is a single command with no separate download or build step.
  • โœ“MIT license, so no copyleft obligations or extra usage restrictions on top of what your own project already carries.
  • โœ“A wide spread of community integrations means most legacy PHP CMS and framework stacks (WordPress, Drupal, Magento, TYPO3, Joomla!, CakePHP, and others) have some path to Sentry, even though the SDK itself only ships the Symfony/Laravel pair.

Considerations for Using Sentry PHP

  • โ–ณThe README doesn't state a minimum supported PHP version anywhere in the text provided, so check the package's composer.json before assuming compatibility with older PHP installs.
  • โ–ณFramework integrations split across four SDK generations (1.x, 2.x, 3.x, and 4.x) in the README, and several older-framework integrations (Zend Framework, the original CakePHP one, OpenCart, the older TYPO3 client) are tied to SDK versions the README labels as old rather than the current 4.x line โ€” worth checking before wiring one into a new project.
  • โ–ณMost third-party framework and CMS integrations listed in the README are community-maintained, not built or supported by the Sentry team, so update cadence and quality vary by maintainer.
  • โ–ณThe SDK only captures and formats error data; it has nothing to send events to without a Sentry account (hosted on sentry.io or self-hosted), which is a separate signup/setup step this repo doesn't cover.
  • โ–ณDay-to-day configuration beyond the DSN โ€” sampling rates, release tracking, breadcrumbs, performance monitoring โ€” isn't documented in the README itself; it points to Sentry's own docs site instead.

Other PHP Error Monitoring Solutions

Bugsnag PHP โ€” another hosted error-monitoring SDK with a similar init-and-capture model, a paid alternative to Sentry's hosted plans.Rollbar PHP โ€” a comparable hosted crash-reporting service with its own PHP client library.Whoops โ€” a PHP error-page and handler library that displays exceptions locally instead of shipping them to a hosted service; useful if you want debugging output, not an external dashboard.PHP's built-in error_log and set_exception_handler โ€” the free, no-dependency fallback if you're not ready to send data to any third-party service at all.

Common Questions About Sentry PHP

How do I install the Sentry PHP SDK?

Composer installs Official Sentry SDK for PHP with a single command: `composer require sentry/sentry`, as documented in the README.

How do I configure Sentry for my PHP application?

Call \Sentry\init(['dsn' => '<your DSN>']) as early as possible in your application's startup, using the DSN from your Sentry project. After that, catch exceptions and pass them to \Sentry\captureException() to send them.

What PHP frameworks does Sentry officially support?

The Sentry team itself builds and maintains official integrations for Symfony (sentry-symfony) and Laravel (sentry-laravel), both listed in the README's official integrations section.

Can I use Sentry PHP SDK with older PHP frameworks?

Community-maintained integrations extend Official Sentry SDK for PHP to older frameworks and SDK generations, including Zend Framework, Yii2, Silverstripe, CakePHP, October CMS, and OpenCart, according to the README's version-tiered integration list.

What license is the Sentry PHP SDK released under?

Official Sentry SDK for PHP is released under the MIT license, per the LICENSE file referenced in the README.

Where can I get support for the Sentry PHP SDK?

The README points to the Sentry Community on Discord for setup and configuration help, plus GitHub's issue tracker on the getsentry/sentry-php repository for bugs.

The problem it solves

PHP applications throw exceptions and errors constantly in production, but by default that information sits in a server log file โ€” or nowhere โ€” instead of somewhere a developer can search, group by type, and act on before a user files a support ticket. Official Sentry SDK for PHP exists to close that gap for PHP specifically: it's the client code that intercepts an exception inside your PHP process and forwards it, with context, to a Sentry project, turning a scroll through raw logs into a single event you can review inside Sentry.

Who should try it โ€” and who should skip

Try Official Sentry SDK for PHP if you already run (or plan to run) a Sentry project โ€” hosted on sentry.io or self-hosted โ€” and want the officially maintained PHP client instead of rolling your own error-reporting glue, especially on Symfony or Laravel where the integrations are built and maintained by the Sentry team itself. Skip it if you don't have a Sentry destination for the events, or if your stack depends on one of the older community-maintained integrations (SDK 1.x-3.x era) where you'd need to verify it's still actively kept up before depending on it.

Related repositories

Source & attribution

Facts and quotes sourced from the getsentry/sentry-php GitHub repository and its README.

GitHub data ยท last synced Aug 12, 2026Reviewed by Henry
โ† Back to TopGit

Want a second opinion on sentry-php?

Ask an AI that can read this page โ€” one click and you get its take on sentry-php.

GitHub