承接 c0dem1ner/laravel-telegram-logger 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

c0dem1ner/laravel-telegram-logger

最新稳定版本:1.0.9

Composer 安装命令:

composer require c0dem1ner/laravel-telegram-logger

包简介

Telegram Log integration for Laravel

README 文档

README

A simple Laravel package to send log messages directly to a Telegram chat or group using the Telegram Bot API.

Features

  • Log messages from Laravel to Telegram in real-time.
  • Easy setup with simple configuration.
  • Customizable Telegram message format.

Installation

composer require c0dem1ner/laravel-telegram-logger

Configuration

  1. Publish the config file:
php artisan vendor:publish --tag=telegram-logger-config
  1. Update the .env file:
TELEGRAM_BOT_TOKEN=your-telegram-bot-token
TELEGRAM_CHAT_ID=your-telegram-chat-id
  1. Configure logging in config/logging.php:
'channels' => [
    // other channels...

    'telegram' => [
            'driver' => 'custom',
            'level' => env('LOG_LEVEL', 'debug'),
            'via' => \C0deM1ner\LaravelTelegramLogger\Logger\TelegramLogger::class,
            'chat_id' => env('TELEGRAM_CHAT_ID', '1234567'),
            'token' => env('TELEGRAM_BOT_TOKEN', '')
            'type' => 'alert', // can be 'alert', 'error', 'info'
        ],
        
        // You can also add multiple Telegram channels
    ],
],

Usage

You can log directly to Telegram using:

telegramLog()->info('Your message here');
telegramLog()->alert('Your message here');
telegramLog()->error('Your message here');

Or use Laravel’s global logging:

    logger()
        ->channel('telegram')
        ->debug('Your message here');

Any log message matching the configured level will be sent to Telegram.

Customizing Messages

If needed, you can publish and edit the view for Telegram messages:

php artisan vendor:publish --tag=telegram-logger-views

Customize the message structure in resources/views/vendor/telegram-logger/messages.

Testing

You can test your configuration by running:

php artisan telegram-log:send-test-message

License

This package is open-sourced software licensed under the MIT license.

Credits

  • Developed by C0deM1ner
  • Telegram Bot API

Contributions

Contributions are welcome! Please open issues or submit PRs.

Security

If you discover any security-related issues, please email noro.danielyan.1998@gmail.com instead of using the issue tracker.

统计信息

  • 总下载量: 164
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固