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

Bugcatch Bundle Laravel Package

culabs/bugcatch-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the package via Composer:

    composer require culabs/bugcatch-bundle
    

    Enable the bundle in config/bundles.php:

    return [
        // ...
        Culabs\BugCatchBundle\CulabsBugCatchBundle::class => ['all' => true],
    ];
    
  2. Configuration Publish the default config:

    php bin/console culabs:bugcatch:install
    

    Update config/packages/culabs_bugcatch.yaml with your BugCatch API key:

    culabs_bugcatch:
        api_key: 'your_api_key_here'
        environment: 'production' # or 'development'
    
  3. First Use Case Trigger an error to test integration:

    // In a controller or service
    throw new \RuntimeException('Test error for BugCatch');
    

    Verify the error appears in your BugCatch dashboard.


Implementation Patterns

Error Tracking

  • Automatic Capture The bundle auto-captures uncaught exceptions and logs them to BugCatch. No manual instrumentation needed for most cases.

  • Manual Error Logging Explicitly log errors for critical paths:

    use Culabs\BugCatchBundle\Logger\BugCatchLogger;
    
    $logger = $container->get('bugcatch.logger');
    $logger->error('Custom error message', ['context' => ['user_id' => 123]]);
    

Performance Monitoring

  • Track Requests Wrap controller actions to monitor performance:
    use Culabs\BugCatchBundle\Monitor\BugCatchMonitor;
    
    public function index(BugCatchMonitor $monitor) {
        $monitor->start('controller.index');
        // ... logic
        $monitor->stop();
    }
    

Integration with Symfony Components

  • Event Listeners Attach to kernel events (e.g., kernel.exception) for custom logic:

    # config/services.yaml
    services:
        App\EventListener\BugCatchListener:
            tags:
                - { name: kernel.event_listener, event: kernel.exception, method: onKernelException }
    
  • Dependency Injection Inject BugCatchClient directly where needed:

    public function __construct(private BugCatchClient $bugCatch) {}
    

Gotchas and Tips

Common Pitfalls

  • API Key Exposure Avoid hardcoding keys in version-controlled files. Use environment variables:

    # .env
    BUGCATCH_API_KEY=your_api_key
    

    Then reference in config:

    culabs_bugcatch:
        api_key: '%env(BUGCATCH_API_KEY)%'
    
  • Sensitive Data Exclude sensitive data (e.g., passwords) from logs:

    culabs_bugcatch:
        filter_sensitive_data: true
    

Debugging

  • Disable in Development Temporarily disable logging in config/packages/culabs_bugcatch.yaml:

    culabs_bugcatch:
        enabled: false
    
  • Check HTTP Client Ensure the underlying HTTP client (Guzzle) isn’t blocked by firewall/proxy.

Extension Points

  • Custom Payloads Extend the logger to add metadata:

    $logger->error('Payment failed', [
        'amount' => $order->amount,
        'user_agent' => $request->headers->get('User-Agent'),
    ]);
    
  • Batch Processing For high-volume errors, use the batch method:

    $logger->batch([
        ['message' => 'Error 1', 'level' => 'error'],
        ['message' => 'Error 2', 'level' => 'warning'],
    ]);
    
  • Async Logging Configure the bundle to use a queue system (e.g., Symfony Messenger) for non-blocking logs:

    culabs_bugcatch:
        use_async: true
    
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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor