bleckert/openpanel-laravel

Laravel provider for Openpanel

v1.2.1 2024-04-04 16:50 UTC

This package is auto-updated.

Last update: 2024-05-04 20:13:53 UTC


README

Latest Version on Packagist

Simple Laravel provider for Openpanel event tracking.

Installation

You can install the package via composer:

composer require bleckert/openpanel-laravel

Setup

Grab your Openpanel ID and secret by navigating to Settings -> Projects and create a client using typ "Other". You'll then recieve an ID and secret.

Add the following to your .env file:

OPENPANEL_CLIENT_ID=your-id
OPENPANEL_CLIENT_SECRET=your-secret

If you self-host Openpanel, you can set the OPENPANEL_URL variable to your Openpanel URL.

OPENPANEL_URL=https://your-openpanel-url.com

Usage

use Bleckert\OpenpanelLaravel\Openpanel;

$openpanel = app(Openpanel::class);

// Identify user
$openpanel->setProfileId(1);

// Update user profile
$openpanel->setProfile(
    id: 1,
    firstName: 'John Doe',
    // ...
);

// Track event
$openpanel->event(
    name: 'User registered',
);

Run in background

By default, Openpanel requests are sent synchronously. If you want to send the requests in the background, you can set OPENPANEL_QUEUE_CONNECTION in your env file.

OPENPANEL_QUEUE_CONNECTION=redis

Optionally, you can set the queue name:

OPENPANEL_QUEUE_NAME=your-queue-name

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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