1. Go to this page and download the library: Download uzhlaravel/telegramlogs 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/ */
use Uzhlaravel\Telegramlogs\Facades\TelegramMessage;
// Simple text
TelegramMessage::message('Scheduled backup completed.');
// With Telegram API options
TelegramMessage::send('Deployment finished', [
'parse_mode' => 'HTML',
'disable_web_page_preview' => true,
]);
// Send to a different chat
TelegramMessage::toChat('-100987654321', 'Alert for ops team');
// Test connectivity
TelegramMessage::test();
// Get bot information
TelegramMessage::getBotInfo();
use Uzhlaravel\Telegramlogs\Traits\HasTelegramActivity;
class Post extends Model
{
use HasTelegramActivity;
}
use Uzhlaravel\Telegramlogs\Traits\HasTelegramActivity;
class Order extends Model
{
use HasTelegramActivity;
// Track only these events for this model
protected array $telegramActivityEvents = ['created', 'deleted'];
// Custom description
public function getTelegramActivityDescription(string $event): string
{
return ucfirst($event) . ' order #' . $this->id . ' — ' . $this->status;
}
// Extra properties to