Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kiriminaja/laravel-telegram-log
Send laravel log via telegram bot chat
https://github.com/kiriminaja/laravel-telegram-log
laravel laravel-bot laravel-plugin laravel-telegram-logger telegram-bot
Last synced: about 2 months ago
JSON representation
Send laravel log via telegram bot chat
- Host: GitHub
- URL: https://github.com/kiriminaja/laravel-telegram-log
- Owner: kiriminaja
- License: mit
- Created: 2022-12-21T05:04:40.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-28T06:44:16.000Z (almost 2 years ago)
- Last Synced: 2024-04-25T10:02:19.302Z (8 months ago)
- Topics: laravel, laravel-bot, laravel-plugin, laravel-telegram-logger, telegram-bot
- Language: PHP
- Homepage:
- Size: 16.6 KB
- Stars: 5
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Laravel Telegram Log
Send logs to Telegram chat via Telegram bot. Inspired by https://github.com/grkamil/laravel-telegram-logging
Documentation
·
Contact Us
·
Fun IG Account
·
Blog## Requirement
- PHP 8.0 above
- Laravel 8 or higher## Install
```bash
composer require kiriminaja/laravel-telegram-log
```## Configurations
Please define Telegram Bot Credentials and chat id as environment parameters by modifying `.env` on your project path
```dotenv
TELEGRAM_BOT_TOKEN=null
TELEGRAM_CHAT_ID=null
TELEGRAM_LOGGER_TEMPLATE=null
TELEGRAM_OPTIONS=[]
```
Create new logging channel by modifying **config/logging.php** file
```php
'telegram' => [
'driver' => 'custom',
'via' => TelegramLog\TelegramLogger::class,
'level' => 'debug',
]
```
Or if your default log channel is a stack, you can add it to the stack channel like this
```php
'stack' => [
'driver' => 'stack',
'channels' => ['single', 'telegram'],
]
```
By default `LOG_CHANNEL` will be set into `stack` so you need to set default logger on env after setting up configurations above
```dotenv
LOG_CHANNEL=telegram
```
Publish config file and views to override
```shell
php artisan vendor:publish --provider "TelegramLog\TelegramServiceProvider"
```## Create bot
For using this plugin, you need to create telegram bot
1. Go to [@BotFather](https://t.me/botfather) in the Telegram
2. Send `/newbot`
3. Set up name and bot-name for your bot.
4. Get token and add it to your .env file (it is written above)
5. Go to your bot and send `/start` message## Change log template at runtime
1. Change config for template.
```php
config(['telegram-logger.template'=>'laravel-telegram-logging::custom'])
```
2. Use `Log` as usual