kiriminaja / laravel-telegram-log
Send laravel logs into Telegram Chat via bot
Installs: 4 504
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 0
Open Issues: 0
Requires
- php: ^7.4|^8.0
- illuminate/support: ^9.45
- monolog/monolog: ^2.0
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
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
TELEGRAM_BOT_TOKEN=null TELEGRAM_CHAT_ID=null TELEGRAM_LOGGER_TEMPLATE=null TELEGRAM_OPTIONS=[]
Create new logging channel by modifying config/logging.php file
'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
'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
LOG_CHANNEL=telegram
Publish config file and views to override
php artisan vendor:publish --provider "TelegramLog\TelegramServiceProvider"
Create bot
For using this plugin, you need to create telegram bot
- Go to @BotFather in the Telegram
- Send
/newbot
- Set up name and bot-name for your bot.
- Get token and add it to your .env file (it is written above)
- Go to your bot and send
/start
message
Change log template at runtime
- Change config for template.
config(['telegram-logger.template'=>'laravel-telegram-logging::custom'])
- Use
Log
as usual