From 91dde684759ba38977396411e0aecc2ecd779d5f Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Mon, 30 Jan 2023 12:07:53 +0100 Subject: [PATCH 1/2] Laravel 10 updates --- src/platforms/php/guides/laravel/index.mdx | 6 +- .../guides/laravel/other-versions/index.mdx | 2 +- .../laravel/other-versions/laravel4.mdx | 2 +- .../laravel/other-versions/laravel5.mdx | 2 +- .../laravel/other-versions/laravel6-7.mdx | 2 +- .../laravel/other-versions/laravel8-9.mdx | 100 ++++++++++++++++++ .../guides/laravel/other-versions/lumen.mdx | 2 +- 7 files changed, 108 insertions(+), 8 deletions(-) create mode 100644 src/platforms/php/guides/laravel/other-versions/laravel8-9.mdx diff --git a/src/platforms/php/guides/laravel/index.mdx b/src/platforms/php/guides/laravel/index.mdx index 467d7f58cbe99..67ae6d104922a 100644 --- a/src/platforms/php/guides/laravel/index.mdx +++ b/src/platforms/php/guides/laravel/index.mdx @@ -10,7 +10,7 @@ description: "Learn about using Sentry with Laravel." Laravel is supported using a native package: [sentry-laravel](https://github.com/getsentry/sentry-laravel). -This guide is for Laravel 8+. We also provide instructions for [other versions](/platforms/php/guides/laravel/other-versions/) as well as [Lumen-specific instructions](/platforms/php/guides/laravel/other-versions/lumen/). +This guide is for Laravel 10.x. We also provide instructions for [other versions](/platforms/php/guides/laravel/other-versions/) as well as [Lumen-specific instructions](/platforms/php/guides/laravel/other-versions/lumen/). ## Install @@ -25,7 +25,7 @@ Enable capturing unhandled exception to report to Sentry by making the following ```php {filename:App/Exceptions/Handler.php} use Sentry\Laravel\Integration; -public function register() +public function register(): void { $this->reportable(function (Throwable $e) { Integration::captureUnhandledException($e); @@ -77,7 +77,7 @@ Visiting this route will trigger an exception that will be captured by Sentry. ## Performance Monitoring -Set `traces_sample_rate` in `config/sentry.php` or `SENTRY_TRACES_SAMPLE_RATE` in your `.env` to a value greater than `0.0`. Setting a value greater than `0.0` will enable Performance Monitoring, `0` (the default) will disable Performance Monitoring. +Set `traces_sample_rate` in `config/sentry.php` or `SENTRY_TRACES_SAMPLE_RATE` in your `.env` to a value greater than `0.0`. Setting a value greater than `0.0` will enable Performance Monitoring, `null` (the default) will disable Performance Monitoring. ```shell {filename:.env} # Be sure to lower this value in production otherwise you could burn through your quota quickly. diff --git a/src/platforms/php/guides/laravel/other-versions/index.mdx b/src/platforms/php/guides/laravel/other-versions/index.mdx index d56c33657eba9..8927e56dd2a32 100644 --- a/src/platforms/php/guides/laravel/other-versions/index.mdx +++ b/src/platforms/php/guides/laravel/other-versions/index.mdx @@ -1,6 +1,6 @@ --- title: Other Versions -description: "Learn about using Sentry with Laravel Lumen or Laravel 4.x/5.x/6.x/7.x." +description: "Learn about using Sentry with Laravel Lumen or Laravel 4.x/5.x/6.x/7.x/8.x/9.x." --- diff --git a/src/platforms/php/guides/laravel/other-versions/laravel4.mdx b/src/platforms/php/guides/laravel/other-versions/laravel4.mdx index 849783a024d7b..f42ff258263a0 100644 --- a/src/platforms/php/guides/laravel/other-versions/laravel4.mdx +++ b/src/platforms/php/guides/laravel/other-versions/laravel4.mdx @@ -1,7 +1,7 @@ --- title: Laravel 4.x description: "Learn about using Sentry with Laravel 4.x." -sidebar_order: 300 +sidebar_order: 400 redirect_from: - /platforms/php/guides/laravel/configuration/other-versions/laravel4/ --- diff --git a/src/platforms/php/guides/laravel/other-versions/laravel5.mdx b/src/platforms/php/guides/laravel/other-versions/laravel5.mdx index 4f0f4e9fa58da..74ec0ad09f357 100644 --- a/src/platforms/php/guides/laravel/other-versions/laravel5.mdx +++ b/src/platforms/php/guides/laravel/other-versions/laravel5.mdx @@ -1,7 +1,7 @@ --- title: Laravel 5.x description: "Learn about using Sentry with Laravel 5.x." -sidebar_order: 200 +sidebar_order: 300 --- diff --git a/src/platforms/php/guides/laravel/other-versions/laravel6-7.mdx b/src/platforms/php/guides/laravel/other-versions/laravel6-7.mdx index 3cd0976af1b69..cf4135e588ca5 100644 --- a/src/platforms/php/guides/laravel/other-versions/laravel6-7.mdx +++ b/src/platforms/php/guides/laravel/other-versions/laravel6-7.mdx @@ -1,7 +1,7 @@ --- title: Laravel 6.x, and 7.x description: "Learn about using Sentry with Laravel 6.x, and 7.x." -sidebar_order: 100 +sidebar_order: 200 --- Laravel is supported using a native package: [sentry-laravel](https://github.com/getsentry/sentry-laravel). diff --git a/src/platforms/php/guides/laravel/other-versions/laravel8-9.mdx b/src/platforms/php/guides/laravel/other-versions/laravel8-9.mdx new file mode 100644 index 0000000000000..78cd17053849c --- /dev/null +++ b/src/platforms/php/guides/laravel/other-versions/laravel8-9.mdx @@ -0,0 +1,100 @@ +--- +title: Laravel 8.x, and 9.x +description: "Learn about using Sentry with Laravel 8.x, and 9.x." +sidebar_order: 100 +--- + +Laravel is supported using a native package: [sentry-laravel](https://github.com/getsentry/sentry-laravel). + +This guide is for Laravel 8.x, and 9.x. We also provide instructions for [other versions](/platforms/php/guides/laravel/other-versions/) as well as [Lumen-specific instructions](/platforms/php/guides/laravel/other-versions/lumen/). + +## Install + +Install the `sentry/sentry-laravel` package: + +```bash +composer require sentry/sentry-laravel +``` + +Enable capturing unhandled exception to report to Sentry by making the following change to your `App/Exceptions/Handler.php`: + +```php {filename:App/Exceptions/Handler.php} +use Sentry\Laravel\Integration; + +public function register() +{ + $this->reportable(function (Throwable $e) { + Integration::captureUnhandledException($e); + }); +} +``` + + + +Alternatively, you can configure Sentry in your [Laravel Log Channel](usage/#log-channels), allowing you to log `info` and `debug` as well. + + + +## Configure + +Configure the Sentry DSN with this command: + +```shell +php artisan sentry:publish --dsn=___PUBLIC_DSN___ +``` + +It creates the config file (`config/sentry.php`) and adds the `DSN` to your `.env` file. + +```shell {filename:.env} +SENTRY_LARAVEL_DSN=___PUBLIC_DSN___ +``` + +## Verify + +### Verify With Artisan + +You can test your configuration using the provided `sentry:test` artisan command: + +```shell +php artisan sentry:test +``` + +### Verify With Code + +You can verify that Sentry is capturing errors in your Laravel application by creating a route that will throw an exception: + +```php {filename:routes/web.php} +Route::get('/debug-sentry', function () { + throw new Exception('My first Sentry error!'); +}); +``` + +Visiting this route will trigger an exception that will be captured by Sentry. + +## Performance Monitoring + +Set `traces_sample_rate` in `config/sentry.php` or `SENTRY_TRACES_SAMPLE_RATE` in your `.env` to a value greater than `0.0`. Setting a value greater than `0.0` will enable Performance Monitoring, `null` (the default) will disable Performance Monitoring. + +```shell {filename:.env} +# Be sure to lower this value in production otherwise you could burn through your quota quickly. +SENTRY_TRACES_SAMPLE_RATE=1.0 +``` + +The example configuration above will transmit 100% of captured traces. Be sure to lower this value in production or you could use up your quota quickly. + +You can also be more granular with the sample rate by using the `traces_sampler` option. Learn more in [Using Sampling to Filter Transaction Events](configuration/filtering/#using-sampling-to-filter-transaction-events). + +Performance data is transmitted using a new event type called "transactions", which you can learn about in [Distributed Tracing](/product/sentry-basics/tracing/distributed-tracing/#traces-transactions-and-spans). + +## Local Development and Testing + +When Sentry is installed in your application, it will also be active when you are developing or running tests. + +You most likely don't want errors to be sent to Sentry when you are developing or running tests. To avoid this, set the DSN value to `null` to disable sending errors to Sentry. + +You can also do this by not defining `SENTRY_LARAVEL_DSN` in your `.env` or by defining it as `SENTRY_LARAVEL_DSN=null`. + +If you do leave Sentry enabled when developing or running tests, it's possible for it to have a negative effect on the performance of your application or test suite. + + + diff --git a/src/platforms/php/guides/laravel/other-versions/lumen.mdx b/src/platforms/php/guides/laravel/other-versions/lumen.mdx index 17b8b5af2bc36..b05722ec279c2 100644 --- a/src/platforms/php/guides/laravel/other-versions/lumen.mdx +++ b/src/platforms/php/guides/laravel/other-versions/lumen.mdx @@ -1,7 +1,7 @@ --- title: Laravel Lumen description: "Learn about using Sentry with Laravel Lumen." -sidebar_order: 400 +sidebar_order: 500 redirect_from: - /platforms/php/guides/laravel/configuration/other-versions/lumen/ --- From e2f84fcd22eb1b34220fe1e9edde5557ff29bbb6 Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Mon, 30 Jan 2023 12:42:40 +0100 Subject: [PATCH 2/2] Merge Larvael 10 --- src/platforms/php/guides/laravel/index.mdx | 2 +- .../guides/laravel/other-versions/index.mdx | 2 +- .../laravel/other-versions/laravel4.mdx | 2 +- .../laravel/other-versions/laravel5.mdx | 2 +- .../laravel/other-versions/laravel6-7.mdx | 2 +- .../laravel/other-versions/laravel8-9.mdx | 100 ------------------ .../guides/laravel/other-versions/lumen.mdx | 2 +- 7 files changed, 6 insertions(+), 106 deletions(-) delete mode 100644 src/platforms/php/guides/laravel/other-versions/laravel8-9.mdx diff --git a/src/platforms/php/guides/laravel/index.mdx b/src/platforms/php/guides/laravel/index.mdx index 67ae6d104922a..079c8d496137e 100644 --- a/src/platforms/php/guides/laravel/index.mdx +++ b/src/platforms/php/guides/laravel/index.mdx @@ -10,7 +10,7 @@ description: "Learn about using Sentry with Laravel." Laravel is supported using a native package: [sentry-laravel](https://github.com/getsentry/sentry-laravel). -This guide is for Laravel 10.x. We also provide instructions for [other versions](/platforms/php/guides/laravel/other-versions/) as well as [Lumen-specific instructions](/platforms/php/guides/laravel/other-versions/lumen/). +This guide is for Laravel 8.x, 9.x and 10.x. We also provide instructions for [other versions](/platforms/php/guides/laravel/other-versions/) as well as [Lumen-specific instructions](/platforms/php/guides/laravel/other-versions/lumen/). ## Install diff --git a/src/platforms/php/guides/laravel/other-versions/index.mdx b/src/platforms/php/guides/laravel/other-versions/index.mdx index 8927e56dd2a32..d56c33657eba9 100644 --- a/src/platforms/php/guides/laravel/other-versions/index.mdx +++ b/src/platforms/php/guides/laravel/other-versions/index.mdx @@ -1,6 +1,6 @@ --- title: Other Versions -description: "Learn about using Sentry with Laravel Lumen or Laravel 4.x/5.x/6.x/7.x/8.x/9.x." +description: "Learn about using Sentry with Laravel Lumen or Laravel 4.x/5.x/6.x/7.x." --- diff --git a/src/platforms/php/guides/laravel/other-versions/laravel4.mdx b/src/platforms/php/guides/laravel/other-versions/laravel4.mdx index f42ff258263a0..849783a024d7b 100644 --- a/src/platforms/php/guides/laravel/other-versions/laravel4.mdx +++ b/src/platforms/php/guides/laravel/other-versions/laravel4.mdx @@ -1,7 +1,7 @@ --- title: Laravel 4.x description: "Learn about using Sentry with Laravel 4.x." -sidebar_order: 400 +sidebar_order: 300 redirect_from: - /platforms/php/guides/laravel/configuration/other-versions/laravel4/ --- diff --git a/src/platforms/php/guides/laravel/other-versions/laravel5.mdx b/src/platforms/php/guides/laravel/other-versions/laravel5.mdx index 74ec0ad09f357..4f0f4e9fa58da 100644 --- a/src/platforms/php/guides/laravel/other-versions/laravel5.mdx +++ b/src/platforms/php/guides/laravel/other-versions/laravel5.mdx @@ -1,7 +1,7 @@ --- title: Laravel 5.x description: "Learn about using Sentry with Laravel 5.x." -sidebar_order: 300 +sidebar_order: 200 --- diff --git a/src/platforms/php/guides/laravel/other-versions/laravel6-7.mdx b/src/platforms/php/guides/laravel/other-versions/laravel6-7.mdx index cf4135e588ca5..3cd0976af1b69 100644 --- a/src/platforms/php/guides/laravel/other-versions/laravel6-7.mdx +++ b/src/platforms/php/guides/laravel/other-versions/laravel6-7.mdx @@ -1,7 +1,7 @@ --- title: Laravel 6.x, and 7.x description: "Learn about using Sentry with Laravel 6.x, and 7.x." -sidebar_order: 200 +sidebar_order: 100 --- Laravel is supported using a native package: [sentry-laravel](https://github.com/getsentry/sentry-laravel). diff --git a/src/platforms/php/guides/laravel/other-versions/laravel8-9.mdx b/src/platforms/php/guides/laravel/other-versions/laravel8-9.mdx deleted file mode 100644 index 78cd17053849c..0000000000000 --- a/src/platforms/php/guides/laravel/other-versions/laravel8-9.mdx +++ /dev/null @@ -1,100 +0,0 @@ ---- -title: Laravel 8.x, and 9.x -description: "Learn about using Sentry with Laravel 8.x, and 9.x." -sidebar_order: 100 ---- - -Laravel is supported using a native package: [sentry-laravel](https://github.com/getsentry/sentry-laravel). - -This guide is for Laravel 8.x, and 9.x. We also provide instructions for [other versions](/platforms/php/guides/laravel/other-versions/) as well as [Lumen-specific instructions](/platforms/php/guides/laravel/other-versions/lumen/). - -## Install - -Install the `sentry/sentry-laravel` package: - -```bash -composer require sentry/sentry-laravel -``` - -Enable capturing unhandled exception to report to Sentry by making the following change to your `App/Exceptions/Handler.php`: - -```php {filename:App/Exceptions/Handler.php} -use Sentry\Laravel\Integration; - -public function register() -{ - $this->reportable(function (Throwable $e) { - Integration::captureUnhandledException($e); - }); -} -``` - - - -Alternatively, you can configure Sentry in your [Laravel Log Channel](usage/#log-channels), allowing you to log `info` and `debug` as well. - - - -## Configure - -Configure the Sentry DSN with this command: - -```shell -php artisan sentry:publish --dsn=___PUBLIC_DSN___ -``` - -It creates the config file (`config/sentry.php`) and adds the `DSN` to your `.env` file. - -```shell {filename:.env} -SENTRY_LARAVEL_DSN=___PUBLIC_DSN___ -``` - -## Verify - -### Verify With Artisan - -You can test your configuration using the provided `sentry:test` artisan command: - -```shell -php artisan sentry:test -``` - -### Verify With Code - -You can verify that Sentry is capturing errors in your Laravel application by creating a route that will throw an exception: - -```php {filename:routes/web.php} -Route::get('/debug-sentry', function () { - throw new Exception('My first Sentry error!'); -}); -``` - -Visiting this route will trigger an exception that will be captured by Sentry. - -## Performance Monitoring - -Set `traces_sample_rate` in `config/sentry.php` or `SENTRY_TRACES_SAMPLE_RATE` in your `.env` to a value greater than `0.0`. Setting a value greater than `0.0` will enable Performance Monitoring, `null` (the default) will disable Performance Monitoring. - -```shell {filename:.env} -# Be sure to lower this value in production otherwise you could burn through your quota quickly. -SENTRY_TRACES_SAMPLE_RATE=1.0 -``` - -The example configuration above will transmit 100% of captured traces. Be sure to lower this value in production or you could use up your quota quickly. - -You can also be more granular with the sample rate by using the `traces_sampler` option. Learn more in [Using Sampling to Filter Transaction Events](configuration/filtering/#using-sampling-to-filter-transaction-events). - -Performance data is transmitted using a new event type called "transactions", which you can learn about in [Distributed Tracing](/product/sentry-basics/tracing/distributed-tracing/#traces-transactions-and-spans). - -## Local Development and Testing - -When Sentry is installed in your application, it will also be active when you are developing or running tests. - -You most likely don't want errors to be sent to Sentry when you are developing or running tests. To avoid this, set the DSN value to `null` to disable sending errors to Sentry. - -You can also do this by not defining `SENTRY_LARAVEL_DSN` in your `.env` or by defining it as `SENTRY_LARAVEL_DSN=null`. - -If you do leave Sentry enabled when developing or running tests, it's possible for it to have a negative effect on the performance of your application or test suite. - - - diff --git a/src/platforms/php/guides/laravel/other-versions/lumen.mdx b/src/platforms/php/guides/laravel/other-versions/lumen.mdx index b05722ec279c2..17b8b5af2bc36 100644 --- a/src/platforms/php/guides/laravel/other-versions/lumen.mdx +++ b/src/platforms/php/guides/laravel/other-versions/lumen.mdx @@ -1,7 +1,7 @@ --- title: Laravel Lumen description: "Learn about using Sentry with Laravel Lumen." -sidebar_order: 500 +sidebar_order: 400 redirect_from: - /platforms/php/guides/laravel/configuration/other-versions/lumen/ ---