Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Symfony Flex recipe to Installation Instructions #321

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
66 changes: 40 additions & 26 deletions README.md
Expand Up @@ -21,37 +21,28 @@ Use sentry-symfony for:
- app path
- excluded paths (cache and vendor)

## Installation

### Step 1: Download the Bundle
You can install this bundle using Composer:

## Installation with Symfony Flex (Symfony 4 or newer):
If you're using the [Symfony Flex](https://symfony.com/doc/current/setup/flex.html) Composer plugin, you can install this bundle in a single, easy step:
```bash
composer require sentry/sentry-symfony:^3.0
composer require sentry/sentry-symfony
```
This could show a message similar to this:
```
The recipe for this package comes from the "contrib" repository, which is open to community contributions.
Review the recipe at https://github.com/symfony/recipes-contrib/tree/master/sentry/sentry-symfony/3.0

#### Optional: use custom HTTP factory/transport
*Note: this step is optional*

Since SDK 2.0 uses HTTPlug to remain transport-agnostic, you need to have installed two packages that provides
[`php-http/async-client-implementation`](https://packagist.org/providers/php-http/async-client-implementation)
and [`http-message-implementation`](https://packagist.org/providers/psr/http-message-implementation).

This bundle depends on `sentry/sdk`, which is a metapackage that already solves this need, requiring our suggested HTTP
packages: the Curl client and Guzzle's message factories.
Do you want to execute this recipe?
```
Press `y` and return to allow the installation.

If instead you want to use a different HTTP client or message factory, you'll need to require manually those additional
packages:
## Installation without Symfony Flex:
### Step 1: Download the Bundle
You can install this bundle using Composer:

```bash
composer require sentry/sentry-symfony:^3.0 sentry/sentry:^2.0 php-http/guzzle6-adapter guzzlehttp/psr7
composer require sentry/sentry-symfony:^3.0
```

The `sentry/sentry` package is required directly to override `sentry/sdk`, and the other two packages are up to your choice;
in the current example, we're using both Guzzle's components (client and message factory).

> TODO: Flex recipe

### Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles
Expand Down Expand Up @@ -80,10 +71,10 @@ class AppKernel extends Kernel
Note that, unlike before in version 3, the bundle will be enabled in all environments; event reporting, instead, is enabled
only when providing a DSN (see the next step).

### Step 3: Configure the SDK
## Configuration of the SDK

Add your [Sentry DSN](https://docs.sentry.io/quickstart/#configure-the-dsn) value of your project to ``app/config/config_prod.yml``.
Leaving this value empty (or undeclared) in other environments will effectively disable Sentry reporting.
Add your [Sentry DSN](https://docs.sentry.io/quickstart/#configure-the-dsn) value of your project, if you have Symfony 3.4 add it to ``app/config/config_prod.yml`` for Symfony 4 or newer add the value to `config/packages/sentry.yaml`.
Keep in mind that leaving the `dsn` value empty (or undeclared) in other environments will effectively disable Sentry reporting.

```yaml
sentry:
Expand Down Expand Up @@ -137,6 +128,29 @@ services:
tags: { name: monolog.processor, handler: sentry }
```

#### Optional: use custom HTTP factory/transport

Since SDK 2.0 uses HTTPlug to remain transport-agnostic, you need to have installed two packages that provides
[`php-http/async-client-implementation`](https://packagist.org/providers/php-http/async-client-implementation)
and [`http-message-implementation`](https://packagist.org/providers/psr/http-message-implementation).

This bundle depends on `sentry/sdk`, which is a metapackage that already solves this need, requiring our suggested HTTP
packages: the Curl client and Guzzle's message factories.

If instead you want to use a different HTTP client or message factory, you can override the ``sentry/sdk`` package adding the following to your ``composer.json`` after the ``require`` section:
```yaml
"replace": {
"sentry/sdk": "*"
}
```
This will prevent the installation of ``sentry/sdk`` package and will allow you to install through Composer the HTTP client or message factory of your choice.

For example for using Guzzle's components:

```bash
composer require php-http/guzzle6-adapter guzzlehttp/psr7
```

## Maintained versions
* 3.x is actively maintained and developed on the master branch, and uses Sentry SDK 2.0;
* 2.x is supported only for fixes; from this version onwards it requires Symfony 3+ and PHP 7.1+;
Expand Down