longlog / yii2-ext
Yii2 extension for LongLog application
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- longlog/php-sdk: *
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-12-27 22:31:37 UTC
README
Yii2 extension for LongLog application
Installation
composer require "longlog/yii2-ext" "~1.0"
Configurations
Edit /common/config/main.php
:
<?php return [ 'components' => [ 'longlog' => [ 'class' => '\longlog\yii2\Component', 'endpointUrl' => 'http://api.longlog.ru', 'projectToken' => 'p8eGzXz5o4A2eulYhBvbrkghbAfirRwL', ], ], ];
Usage
Variant 1: LongLog with client wrapper
<?php // New LongLog instance with client wrapper $longLog = Yii::$app->longlog->newLog('CRON_SEND_EMAILS'); // Optionaly set payload any string $longLog->setPayload("userIds: [1,2,3]"); // Remember the processing start time $longLog->start(); // ...YOUR JOB HERE... // Submit LongLog to API $longLog->finish()->submit();
Variant 2: LongLog without client wrapper
<?php // New LongLog instance without client wrapper $longLog = new \longlog\LongLog('CRON_SEND_EMAILS'); // Optionaly set payload any string $longLog->setPayload("userIds: [1,2,3]"); // Remember the processing start time $longLog->start(); // ...YOUR JOB HERE... // Calculate job processing time and submit log to API $longLog->finish(); Yii::$app->longlog->getClient()->submit($longLog);