---
title: "Legacy SDK"
url: https://docs.sentry.io/platforms/php/legacy-sdk/
---

# Legacy SDK | Sentry for PHP

##### Deprecation Warning

A new PHP SDK has superseded this deprecated version. Sentry preserves this documentation for customers using the old client. If you are using PHP 7.1 or later, we recommend using the [updated PHP SDK](https://docs.sentry.io/platforms/php.md) for your projects.

This PHP SDK for Sentry supports PHP 5.3 and higher. It’s available as a BSD licensed Open Source library.

## [Getting Started](https://docs.sentry.io/platforms/php/legacy-sdk.md#getting-started)

Getting started with Sentry is a three step process:

1. [Sign up for an account](https://sentry.io/signup/)
2. [Install your SDK](https://docs.sentry.io/platforms/php/legacy-sdk.md#install)
3. [Configure it](https://docs.sentry.io/platforms/php/legacy-sdk.md#configure)

## [Installation](https://docs.sentry.io/platforms/php/legacy-sdk.md#installation)

There are various ways to install the PHP integration for Sentry. The recommended way is to use [Composer](https://getcomposer.org/):

```bash
composer require sentry/sentry "^1.0"
```

Alternatively you can manually install it:

1. Download and extract the latest [sentry-php](https://github.com/getsentry/sentry-php/archive/master.zip) archive to your PHP project.

2. Require the autoloader in your application:

   ```php
   require_once '/path/to/Raven/library/Raven/Autoloader.php';
   Raven_Autoloader::register();
   ```

## [Configuration](https://docs.sentry.io/platforms/php/legacy-sdk.md#configuration)

The most important part is the creation of the raven client. Create it once and reference it from anywhere you want to interface with Sentry:

```php
$client = new Raven_Client('___PUBLIC_DSN___');
```

Once you have the client you can either use it manually or enable the automatic error and exception capturing which is recommended:

```php
$error_handler = new Raven_ErrorHandler($client);
$error_handler->registerExceptionHandler();
$error_handler->registerErrorHandler();
$error_handler->registerShutdownFunction();
```

## [Adding Context](https://docs.sentry.io/platforms/php/legacy-sdk.md#adding-context)

Much of the usefulness of Sentry comes from additional context data with the events. The PHP client makes this very convenient by providing methods to set thread local context data that is then submitted automatically with all events. For instance you can use the `user_context` method to add information about the current user:

```php
$client->user_context(array(
    'email' => $USER->getEmail()
));
```

For more information see [Providing Request Context](https://docs.sentry.io/platforms/php/legacy-sdk/config.md#sentry-php-request-context).

## [Deep Dive](https://docs.sentry.io/platforms/php/legacy-sdk.md#deep-dive)

Want more? Have a look at the full documentation for more information.

* [Usage](https://docs.sentry.io/platforms/php/legacy-sdk/usage.md)

* [Configuration](https://docs.sentry.io/platforms/php/legacy-sdk/config.md)

* [Integrations](https://docs.sentry.io/platforms/php/legacy-sdk/integrations.md)

  * [Laravel](https://docs.sentry.io/platforms/php/legacy-sdk/integrations.md#laravel)
  * [Monolog](https://docs.sentry.io/platforms/php/legacy-sdk/integrations.md#monolog)
  * [Symfony](https://docs.sentry.io/platforms/php/legacy-sdk/integrations.md#symfony-2)

Resources:

* [Bug Tracker](https://github.com/getsentry/sentry-php/issues)
* [GitHub Project](https://github.com/getsentry/sentry-php)

## Pages in this section

- [Usage](https://docs.sentry.io/platforms/php/legacy-sdk/usage.md)
- [Configuration](https://docs.sentry.io/platforms/php/legacy-sdk/config.md)
- [Integrations](https://docs.sentry.io/platforms/php/legacy-sdk/integrations.md)
