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

Update/architecture legacy php #970

Merged
merged 6 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions __tests__/__snapshots__/documentation.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ Array [
"clients/php/config/index.html",
"clients/php/index.html",
"clients/php/integrations/index.html",
"clients/php/integrations/laravel/index.html",
"clients/php/integrations/monolog/index.html",
"clients/php/integrations/symfony2/index.html",
"clients/php/usage/index.html",
"clients/python/advanced/index.html",
"clients/python/api/index.html",
Expand Down
12 changes: 12 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,18 @@ server {
location = /clients/node/integrations/sails/ {
return 302 /clients/node/integrations/;
}

location = /clients/php/integrations/laravel/ {
return 302 /clients/php/integrations/;
}

location = /clients/php/integrations/monolog/ {
return 302 /clients/php/integrations/;
}

location = /clients/php/integrations/symfony2/ {
return 302 /clients/php/integrations/;
}

location / {
try_files $uri $uri.html $uri/ $uri/index.html =404;
Expand Down
4 changes: 2 additions & 2 deletions src/_data/platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@
wizard_parent: php
wizard:
- _documentation/clients/php/index.md#installation
- _documentation/clients/php/integrations/monolog.md
- _documentation/clients/php/integrations.md#monolog
-
slug: symfony2
support_level: production
Expand All @@ -518,7 +518,7 @@
doc_link: /clients/php/integrations/symfony2/
wizard_parent: php
wizard:
- _documentation/clients/php/integrations/symfony2.md
- _documentation/clients/php/integrations.md#symfony2
-
slug: ruby
support_level: production
Expand Down
8 changes: 4 additions & 4 deletions src/collections/_documentation/clients/php/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ Want more? Have a look at the full documentation for more information.

- [Usage]({%- link _documentation/clients/php/usage.md -%})
- [Configuration]({%- link _documentation/clients/php/config.md -%})
- [Integrations]({%- link _documentation/clients/php/integrations/index.md -%})
- [Laravel]({%- link _documentation/clients/php/integrations/laravel.md -%})
- [Monolog]({%- link _documentation/clients/php/integrations/monolog.md -%})
- [Symfony]({%- link _documentation/clients/php/integrations/symfony2.md -%})
- [Integrations]({%- link _documentation/clients/php/integrations.md -%})
- [Laravel]({%- link _documentation/clients/php/integrations.md -%}#laravel)
- [Monolog]({%- link _documentation/clients/php/integrations.md -%}#monolog)
- [Symfony]({%- link _documentation/clients/php/integrations.md -%}#symfony2)

Resources:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
title: Laravel
sidebar_order: 3
title: Integrations
---

## Laravel

Laravel is supported via a native package, [sentry-laravel](https://github.com/getsentry/sentry-laravel).

<!-- WIZARD -->
## Laravel 5.x {#laravel-5-x}
### Laravel 5.x {#laravel-5-x}

Install the `sentry/sentry-laravel` package:

Expand Down Expand Up @@ -116,7 +117,7 @@ Next, create `resources/views/errors/500.blade.php`, and embed the feedback code

That’s it!

## Laravel 4.x {#laravel-4-x}
### Laravel 4.x {#laravel-4-x}

Install the `sentry/sentry-laravel` package:

Expand Down Expand Up @@ -164,7 +165,7 @@ If you wish to wire up Sentry anywhere outside of the standard error handlers, o
$app['sentry']->setRelease(Git::sha());
```

## Lumen 5.x {#lumen-5-x}
### Lumen 5.x {#lumen-5-x}

Install the `sentry/sentry-laravel` package:

Expand Down Expand Up @@ -207,7 +208,7 @@ return array(
);
```
<!-- ENDWIZARD -->
## Testing with Artisan
### Testing with Artisan

You can test your configuration using the provided `artisan` command:

Expand All @@ -222,7 +223,7 @@ $ php artisan sentry:test
[sentry] Sending test event with ID: 5256614438cf4e0798dc9688e9545d94
```

## Adding Context
### Adding Context

The mechanism to add context will vary depending on which version of Laravel you’re using, but the general approach is the same. Find a good entry point to your application in which the context you want to add is available, ideally early in the process.

Expand Down Expand Up @@ -265,7 +266,7 @@ class SentryContext
}
```

## Configuration
### Configuration

The following settings are available for the client:

Expand Down Expand Up @@ -304,3 +305,97 @@ The following settings are available for the client:
```php
'user_context' => false,
```

## Monolog

<!-- WIZARD monolog -->
### Capturing Errors

Monolog supports Sentry out of the box, so you’ll just need to configure a handler:

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

$handler = new Monolog\Handler\RavenHandler($client);
$handler->setFormatter(new Monolog\Formatter\LineFormatter("%message% %context% %extra%\n"));

$monolog->pushHandler($handler);
```

### Adding Context

Capturing context can be done via a monolog processor:

```php
$monolog->pushProcessor(function ($record) {
// record the current user
$user = Acme::getCurrentUser();
$record['context']['user'] = array(
'name' => $user->getName(),
'username' => $user->getUsername(),
'email' => $user->getEmail(),
);

// Add various tags
$record['context']['tags'] = array('key' => 'value');

// Add various generic context
$record['extra']['key'] = 'value';

return $record;
});
```

### Breadcrumbs

Sentry provides a breadcrumb handler to automatically send logs along as crumbs:

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

$handler = new \Raven_Breadcrumbs_MonologHandler($client);
$monolog->pushHandler($handler);
```
<!-- ENDWIZARD -->

## Symfony

Symfony is supported via the [sentry-symfony](https://github.com/getsentry/sentry-symfony) package as a native bundle.

<!-- WIZARD symfony2 -->
### Symfony 2+

Install the `sentry/sentry-symfony` package:

```bash
$ composer require sentry/sentry-symfony
```

Enable the bundle in `app/AppKernel.php`:

```php
<?php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...

new Sentry\SentryBundle\SentryBundle(),
);

// ...
}

// ...
}
```

Add your DSN to `app/config/config.yml`:

```yaml
sentry:
dsn: "___PUBLIC_DSN___"
```
<!-- ENDWIZARD -->

This file was deleted.

54 changes: 0 additions & 54 deletions src/collections/_documentation/clients/php/integrations/monolog.md

This file was deleted.

This file was deleted.