Download the PHP package vildanbina/hookshot without Composer
On this page you can find all versions of the php package vildanbina/hookshot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vildanbina/hookshot
More information about vildanbina/hookshot
Files in vildanbina/hookshot
Package hookshot
Short Description A Laravel package for transparently capturing and storing HTTP requests with configurable storage drivers
License MIT
Informations about the package hookshot
HookShot
A Laravel package for capturing and tracking HTTP requests with configurable storage drivers and filtering options.
Overview
HookShot provides middleware-based HTTP request tracking for Laravel applications. It captures request/response data and stores it using database, cache, or file storage drivers with configurable filtering and performance controls.
How it works: The middleware captures request data during the request lifecycle and stores the complete
request/response information during Laravel's terminate phase, ensuring your application's response time is not
affected by the logging process.
Why HookShot?
- 🔍 Debug Issues - Reproduce bugs by seeing exactly what requests caused them
- 📊 Analytics - Track API usage patterns, popular endpoints, and user behavior
- 🛡️ Security - Monitor suspicious requests and track authentication attempts
- 📋 Compliance - Meet audit requirements with comprehensive request logging
- ⚡ Performance - Identify slow endpoints and optimize request handling
- 🔌 API Monitoring - Track external API integrations and webhook deliveries
Requirements
- PHP 8.2+
- Laravel 11.x, 12.x
Installation
Install via Composer:
Publish configuration:
Run migrations for database storage:
Usage
Middleware Registration
Manual Registration (Recommended)
Apply to specific routes:
Global Registration (Laravel 11+)
Add to bootstrap/app.php:
Retrieving Tracked Data
Event Integration
Listen to request capture events:
Features
Storage Drivers:
- Database: Full query support with Eloquent models
- Cache: In-memory storage with configurable TTL
- File: JSON or raw format file logging
- Custom: Implement your own storage driver
Filtering & Sampling:
- Path exclusion patterns
- User agent filtering
- Configurable sampling rates
- Content-type based exclusions
Performance Controls:
- Request/response payload size limits
- Queue-based processing support
- Automatic data retention cleanup
Security:
- Sensitive header filtering
- Authentication data redaction
- Configurable data sanitization
Configuration
All configuration options with their purposes:
Commands
Cleanup Old Data
Remove old tracking data based on retention settings:
Storage Drivers
Database Driver
- Best for queryable, persistent data
- Supports complex filtering and relationships
- Automatic cleanup via retention settings
Cache Driver
- Fastest performance for temporary data
- Good for high-traffic applications
- Limited querying capabilities
File Driver
- Good for development and debugging
- Human-readable storage format
- No database dependencies
Custom Driver
You can create custom storage drivers to integrate with your own storage systems or services. Custom drivers must implement the StorageDriverContract.
Creating a Custom Driver
Configuring Your Custom Driver
Add your custom driver to the configuration file:
The via key tells HookShot which class to use for this driver. The entire config array (including the via key) is passed to your driver's constructor.
Captured Data Structure
Each tracked request includes:
Performance Tips
- High Traffic: Set
sampling_rateto 0.1 (10%) or lower for production - Heavy Workloads: Enable
use_queueto process tracking asynchronously - Memory Management: Limit
max_payload_sizeandmax_response_sizebased on your needs - Reduce Noise: Use
excluded_pathsfor health checks, admin routes, and static assets - Storage Optimization: Configure
retention_daysfor automatic cleanup of old data - Database Space: Disable response capture to save significant storage space:
- Set
capture_response_headersto false in order to disable response header capture - Set
capture_response_bodyto false in order to disable response body capture - Both can be individually controlled based on your storage and debugging needs
- Set
Contributing
See CONTRIBUTING for details.
Security Vulnerabilities
Please e-mail [email protected] to report any security vulnerabilities instead of using the issue tracker.
Credits
- Vildan Bina
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of hookshot with dependencies
illuminate/support Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
illuminate/cache Version ^11.0|^12.0