PHP code example of muensmedia / sentry-http-context

1. Go to this page and download the library: Download muensmedia/sentry-http-context library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

muensmedia / sentry-http-context example snippets


Http::describe('This is a example request. And I am the describe text.')
    ->post('https://webhook.site/…', [
        'title' => 'Lorem Ipsum Payload',
        'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
        'author' => [
            'name' => 'John Doe',
            'email' => '[email protected]',
        ],
        // ...
    ]);

report(new Exception('This exception is for testing reasons'));

Http::withToken($token)
    ->describe('Sync customer to CRM')
    ->post($url, $payload);

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Muensmedia\SentryHttpContext\SentryHttpContext;

class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        SentryHttpContext::useUserAgent(fn () => 'Acme/'.config('app.version'));
    }
}
bash
php artisan vendor:publish --tag=sentry-http-context-config