kalizi/laravel-spyhole

Laravel package to record and re-watch user sessions

v1.0-beta 2021-02-07 22:20 UTC

This package is auto-updated.

Last update: 2024-04-15 15:44:22 UTC


README

68747470733a2f2f6b616c697a692e6465762f737079686f6c655f6c6f676f2e706e67

Total Downloads Latest Stable Version License Quality Score Build Status

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.

Installation

You can install the package via composer:

composer require kalizi/laravel-spyhole

Usage

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")

How it works in short

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.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email me@kalizi.dev instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.