Skip to content

Commit ca94d00

Browse files
authored
Update/architecture legacy php (#970)
* included Laravel, Monolog, & Symfony to index * made integrations its own page * updated links * updated html slug and wizard * updated snapshot * updated redirects
1 parent 26abf05 commit ca94d00

File tree

8 files changed

+121
-122
lines changed

8 files changed

+121
-122
lines changed

__tests__/__snapshots__/documentation.js.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ Array [
201201
"clients/php/config/index.html",
202202
"clients/php/index.html",
203203
"clients/php/integrations/index.html",
204-
"clients/php/integrations/laravel/index.html",
205-
"clients/php/integrations/monolog/index.html",
206-
"clients/php/integrations/symfony2/index.html",
207204
"clients/php/usage/index.html",
208205
"clients/python/advanced/index.html",
209206
"clients/python/api/index.html",

nginx.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,18 @@ server {
270270
location = /clients/node/integrations/sails/ {
271271
return 302 /clients/node/integrations/;
272272
}
273+
274+
location = /clients/php/integrations/laravel/ {
275+
return 302 /clients/php/integrations/;
276+
}
277+
278+
location = /clients/php/integrations/monolog/ {
279+
return 302 /clients/php/integrations/;
280+
}
281+
282+
location = /clients/php/integrations/symfony2/ {
283+
return 302 /clients/php/integrations/;
284+
}
273285

274286
location / {
275287
try_files $uri $uri.html $uri/ $uri/index.html =404;

src/_data/platforms.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@
509509
wizard_parent: php
510510
wizard:
511511
- _documentation/clients/php/index.md#installation
512-
- _documentation/clients/php/integrations/monolog.md
512+
- _documentation/clients/php/integrations.md#monolog
513513
-
514514
slug: symfony2
515515
support_level: production
@@ -518,7 +518,7 @@
518518
doc_link: /clients/php/integrations/symfony2/
519519
wizard_parent: php
520520
wizard:
521-
- _documentation/clients/php/integrations/symfony2.md
521+
- _documentation/clients/php/integrations.md#symfony2
522522
-
523523
slug: ruby
524524
support_level: production

src/collections/_documentation/clients/php/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ Want more? Have a look at the full documentation for more information.
6969

7070
- [Usage]({%- link _documentation/clients/php/usage.md -%})
7171
- [Configuration]({%- link _documentation/clients/php/config.md -%})
72-
- [Integrations]({%- link _documentation/clients/php/integrations/index.md -%})
73-
- [Laravel]({%- link _documentation/clients/php/integrations/laravel.md -%})
74-
- [Monolog]({%- link _documentation/clients/php/integrations/monolog.md -%})
75-
- [Symfony]({%- link _documentation/clients/php/integrations/symfony2.md -%})
72+
- [Integrations]({%- link _documentation/clients/php/integrations.md -%})
73+
- [Laravel]({%- link _documentation/clients/php/integrations.md -%}#laravel)
74+
- [Monolog]({%- link _documentation/clients/php/integrations.md -%}#monolog)
75+
- [Symfony]({%- link _documentation/clients/php/integrations.md -%}#symfony2)
7676

7777
Resources:
7878

src/collections/_documentation/clients/php/integrations/laravel.md renamed to src/collections/_documentation/clients/php/integrations.md

Lines changed: 103 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
---
2-
title: Laravel
3-
sidebar_order: 3
2+
title: Integrations
43
---
54

5+
## Laravel
6+
67
Laravel is supported via a native package, [sentry-laravel](https://github.com/getsentry/sentry-laravel).
78

89
<!-- WIZARD -->
9-
## Laravel 5.x {#laravel-5-x}
10+
### Laravel 5.x {#laravel-5-x}
1011

1112
Install the `sentry/sentry-laravel` package:
1213

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

117118
That’s it!
118119

119-
## Laravel 4.x {#laravel-4-x}
120+
### Laravel 4.x {#laravel-4-x}
120121

121122
Install the `sentry/sentry-laravel` package:
122123

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

167-
## Lumen 5.x {#lumen-5-x}
168+
### Lumen 5.x {#lumen-5-x}
168169

169170
Install the `sentry/sentry-laravel` package:
170171

@@ -207,7 +208,7 @@ return array(
207208
);
208209
```
209210
<!-- ENDWIZARD -->
210-
## Testing with Artisan
211+
### Testing with Artisan
211212

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

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

225-
## Adding Context
226+
### Adding Context
226227

227228
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.
228229

@@ -265,7 +266,7 @@ class SentryContext
265266
}
266267
```
267268

268-
## Configuration
269+
### Configuration
269270

270271
The following settings are available for the client:
271272

@@ -304,3 +305,97 @@ The following settings are available for the client:
304305
```php
305306
'user_context' => false,
306307
```
308+
309+
## Monolog
310+
311+
<!-- WIZARD monolog -->
312+
### Capturing Errors
313+
314+
Monolog supports Sentry out of the box, so you’ll just need to configure a handler:
315+
316+
```php
317+
$client = new Raven_Client('___PUBLIC_DSN___');
318+
319+
$handler = new Monolog\Handler\RavenHandler($client);
320+
$handler->setFormatter(new Monolog\Formatter\LineFormatter("%message% %context% %extra%\n"));
321+
322+
$monolog->pushHandler($handler);
323+
```
324+
325+
### Adding Context
326+
327+
Capturing context can be done via a monolog processor:
328+
329+
```php
330+
$monolog->pushProcessor(function ($record) {
331+
// record the current user
332+
$user = Acme::getCurrentUser();
333+
$record['context']['user'] = array(
334+
'name' => $user->getName(),
335+
'username' => $user->getUsername(),
336+
'email' => $user->getEmail(),
337+
);
338+
339+
// Add various tags
340+
$record['context']['tags'] = array('key' => 'value');
341+
342+
// Add various generic context
343+
$record['extra']['key'] = 'value';
344+
345+
return $record;
346+
});
347+
```
348+
349+
### Breadcrumbs
350+
351+
Sentry provides a breadcrumb handler to automatically send logs along as crumbs:
352+
353+
```php
354+
$client = new Raven_Client('___PUBLIC_DSN___');
355+
356+
$handler = new \Raven_Breadcrumbs_MonologHandler($client);
357+
$monolog->pushHandler($handler);
358+
```
359+
<!-- ENDWIZARD -->
360+
361+
## Symfony
362+
363+
Symfony is supported via the [sentry-symfony](https://github.com/getsentry/sentry-symfony) package as a native bundle.
364+
365+
<!-- WIZARD symfony2 -->
366+
### Symfony 2+
367+
368+
Install the `sentry/sentry-symfony` package:
369+
370+
```bash
371+
$ composer require sentry/sentry-symfony
372+
```
373+
374+
Enable the bundle in `app/AppKernel.php`:
375+
376+
```php
377+
<?php
378+
class AppKernel extends Kernel
379+
{
380+
public function registerBundles()
381+
{
382+
$bundles = array(
383+
// ...
384+
385+
new Sentry\SentryBundle\SentryBundle(),
386+
);
387+
388+
// ...
389+
}
390+
391+
// ...
392+
}
393+
```
394+
395+
Add your DSN to `app/config/config.yml`:
396+
397+
```yaml
398+
sentry:
399+
dsn: "___PUBLIC_DSN___"
400+
```
401+
<!-- ENDWIZARD -->

src/collections/_documentation/clients/php/integrations/index.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/collections/_documentation/clients/php/integrations/monolog.md

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/collections/_documentation/clients/php/integrations/symfony2.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)