PHP code example of roublez / logsnag-php

1. Go to this page and download the library: Download roublez/logsnag-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

roublez / logsnag-php example snippets


use Hallewood\LogSnag\Client;

$logsnag = new Client('7f568d735724351757637b1dbf108e5', 'my-project');


//
// The channel and the event name are the only ;

//
// Other parameters can be added when needed.
$logsnag->log(
    channel: 'subscriptions',
    event: 'User subscribed!',
    userId: '123-456',
    description: 'A new user subscribed to the **premium plan**.',
    icon: '👍🏞',
    notify: true,
    tags: [
        'payment-method': 'card',
        'plan': 'monthly',
    ],
    parser: 'markdown',
    timestamp: 1709842921,
);


//
// Both the user id and the properties are  properties: [
        'active': 'yes',
        'signed-in': 'no',
    ],
);


//
// The title and the value are the only 
//
// Other parameters can be added when needed.
$logsnag->log(
    title: 'Status',
    value: 'watered',
    icon: 'ðŸŠī',
);


//
// The title and at least one mutation is ;

//
// Other parameters can be added when needed.
$logsnag->log(
    title: 'Subscribed Users',
    inc: -2,
    icon: '👍🏞',
);