Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Sentry Feedback Laravel Package

martinpetricko/filament-sentry-feedback

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Install the package:
    composer require martinpetricko/filament-sentry-feedback
    
  2. Publish config (if customization is needed):
    php artisan vendor:publish --tag="filament-sentry-feedback:config"
    
  3. Ensure Sentry is configured in your Laravel app (e.g., config/sentry.php with DSN and SDK setup).
  4. Register the widget in your Filament admin panel:
    // app/Providers/Filament/AdminPanelProvider.php
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->widgets([
                \MartinPetricko\FilamentSentryFeedback\Widgets\SentryFeedbackWidget::class,
            ]);
    }
    

First Use Case

  • Quick feedback collection: Add the widget to your Filament dashboard to let users report issues directly from the UI.
  • Debugging: Use the widget to capture frontend errors or UX pain points without leaving the admin panel.

Implementation Patterns

Common Workflows

  1. Default Integration:

    • Place the widget in a Filament panel via panel()->widgets().
    • No additional config required for basic usage.
  2. Customizing Appearance:

    • Override translations via published config or language files.
    • Adjust widget position in the panel layout (e.g., sidebars, headers).
  3. Conditional Display:

    • Use Filament’s widget visibility logic:
      SentryFeedbackWidget::make()
          ->visible(fn () => auth()->user()->can('report_feedback')),
      
  4. Event Handling:

    • Listen for feedback submissions via Sentry’s SDK events (e.g., sentry.event in Laravel).
  5. Multi-Tenant Support:

    • Pass tenant-specific context to Sentry:
      SentryFeedbackWidget::make()
          ->sentryContext(fn () => ['tenant_id' => auth()->user()->tenant->id]),
      

Integration Tips

  • Sentry SDK Setup: Ensure your Laravel app is configured to send events to Sentry before using this widget.
  • Filament Version Compatibility: Verify the package supports your Filament version (check composer.json constraints).
  • Testing: Mock Sentry SDK calls in unit tests to avoid real API calls:
    $this->mock(Sentry::class)->shouldReceive('captureMessage');
    

Gotchas and Tips

Pitfalls

  1. Missing Sentry Config:

    • If Sentry is not properly configured, the widget will silently fail. Verify config/sentry.php and environment variables (e.g., SENTRY_DSN).
  2. CORS Issues:

    • Ensure your Sentry DSN endpoint is whitelisted in your app’s CORS settings if feedback is submitted via AJAX.
  3. Widget Not Rendering:

    • Check for JavaScript errors in the browser console. The widget relies on Sentry’s frontend SDK.
  4. Rate Limiting:

    • Sentry may throttle feedback submissions. Handle Sentry\State\SdkNotInitialized exceptions gracefully.

Debugging

  • Log Sentry Events: Add a Laravel event listener to log feedback submissions:

    // app/Listeners/LogSentryFeedback.php
    public function handle($event)
    {
        Log::info('Sentry Feedback', $event->getExtraContext());
    }
    

    Register it in EventServiceProvider.

  • Inspect Widget Output: Use browser dev tools to verify the widget’s HTML/JS is loaded. Check for data-testid attributes (e.g., sentry-feedback-widget).

Extension Points

  1. Custom Feedback Fields: Override the widget’s Blade template (resources/views/vendor/filament-sentry-feedback/widget.blade.php) to add fields like:

    <x-filament-sentry-feedback::widget>
        <x-filament::section>
            <x-filament::input name="custom_field" type="text" />
        </x-filament::section>
    </x-filament-sentry-feedback::widget>
    
  2. Dynamic Sentry Context: Extend the widget to inject dynamic data:

    SentryFeedbackWidget::make()
        ->sentryContext(fn () => [
            'user_id' => auth()->id(),
            'ip' => request()->ip(),
        ]),
    
  3. Post-Submission Actions: Hook into Sentry’s event callback to trigger Laravel logic:

    Sentry::extend(function ($sentry) {
        $sentry->event(function ($event) {
            if ($event->getLevel() === 'info' && str_starts_with($event->getMessage(), '[Feedback]')) {
                // Trigger a Laravel job/notification
            }
        });
    });
    
  4. Localization: Publish and extend translations:

    php artisan vendor:publish --tag="filament-sentry-feedback:lang"
    

    Override in resources/lang/en/filament-sentry-feedback.php.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium