Skip to content

Commit 89d64d9

Browse files
committed
update README
1 parent 168299b commit 89d64d9

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

README.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,53 @@
1-
# laravel-telegram-logging
1+
# Laravel Telegram logger
2+
23
Send logs to Telegram chat via Telegram bot
4+
5+
## Install
6+
7+
```
8+
9+
composer require grkamil/laravel-telegram-logger
10+
11+
```
12+
13+
Define Telegram Bot Token and chat id (users telegram id) and set as environment parameters.
14+
Add to <b>.env</b>
15+
16+
```
17+
TELEGRAM_LOGGER_BOT_TOKEN=id:token
18+
TELEGRAM_LOGGER_CHAT_ID=chat_id
19+
```
20+
21+
22+
Add to <b>config/logging.php</b> file new channel:
23+
24+
```php
25+
'telegram' => [
26+
'driver' => 'custom',
27+
'via' => Logger\TelegramLogger::class,
28+
'level' => 'debug',
29+
]
30+
```
31+
32+
If your default log channel is a stack, you can add it to the <b>stack</b> channel like this
33+
```php
34+
'stack' => [
35+
'driver' => 'stack',
36+
'channels' => ['single', 'telegram'],
37+
]
38+
```
39+
40+
Or you can simply change the default log channel in the .env
41+
```
42+
LOG_CHANNEL=telegram
43+
```
44+
45+
## Create bot
46+
47+
For using this package you need to create Telegram bot
48+
49+
1. Go to @BotFather in the Telegram
50+
2. Send ``/newbot``
51+
3. Set up name and bot-name for your bot.
52+
4. Get token and add it to your .env file (it is written above)
53+
5. Go to your bot and send ``/start`` message

0 commit comments

Comments
 (0)