userlog/php

UserLog PHP SDK

v1.0.2 2025-01-14 18:14 UTC

This package is auto-updated.

Last update: 2025-06-14 19:27:20 UTC


README

Installation

composer require userlog/php

Usage

Initialize Client

use UserLog\PHP\Client;

$userlog = new Client('<API_KEY>', '<PROJECT_NAME>');

The project name will be auto-injected in all requests.

Log

// The channel name, event name and user_id are the only required parameters.
$userlog->log('subscriptions', 'User subscribed!', 'user@example.com');

// Other parameters can be added when needed.
$userlog->log(
    channel: 'subscriptions',
    event: 'User subscribed!',
    user_id: 'user@example.com',
    description: 'A new user subscribed to the premium plan.',
    icon: '👍🏼',
    notify: true,
    tags: [
        'payment-method' => 'card',
        'plan' => 'monthly',
    ],
);

Identify

// Both the user id and the properties are required.
$userlog->identify(
    userId: 'user@example.com',
    properties: [
        'active' => 'yes',
        'signed-in' => 'no',
    ],
);