Laravel Spyhole is a user session recorder for the Laravel Framework. Laravel Spyhole is a wrapper for the JS Library RRWeb (Record and replay the web). It allows a simple way to embed the Recorder into your views and start recordings out-of-the-box.
You can install the package via composer:
composer require kalizi/laravel-spyhole
After installation publish the config file:
php artisan vendor:publish --provider="Kalizi\LaravelSpyhole\LaravelSpyholeServiceProvider"
In the configuration file you can set:
- Session ID tracking: this will make the package track the session ID from the Laravel built-in Session, if set to false, a random UUID will be generated for the user session.
- User ID tracking: this will make the package track the user ID with recordings.
- Minimum sampling rate: the minimum number of records to be recorded from frontend before sending. (Default: 50)
Finally, to start recording, just embed the recorder view to the view you want to record.
@include("laravel-spyhole::embed_spyhole")
As pointed before, spyhole uses RRWeb as its internal recorder.
In the resources/assets
folder there are the published assets where you can find the RRWeb files and the built version of recording-handler.js
, a JS script handling the RRWeb initialization and recording sendings.
The recordings are posted to a route named spyhole.store-entry
(whose URL is /spyhole-api/record
). Recordings are accessible via the model Kalizi\LaravelSpyhole\Models\SessionRecording
with properties: ID, path, recordings (an array stored gzipped and base 64 encoded) and user ID.
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.