Download the PHP package nwservices/laravel-telegram-logger without Composer

On this page you can find all versions of the php package nwservices/laravel-telegram-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-telegram-logger

Laravel Telegram Logger

A Laravel package that monitors your laravel.log file and sends Telegram notifications when errors occur. Get instant alerts in your Telegram chat when critical errors happen in your Laravel application.

Features

Requirements

Installation

Install the package via Composer:

The service provider will be automatically registered through Laravel's package auto-discovery.

Publish the configuration file (optional):

Getting a Telegram Bot Token

  1. Open Telegram and search for @BotFather
  2. Start a conversation and send /newbot
  3. Follow the prompts to name your bot
  4. BotFather will provide you with a token like 123456789:ABCdefGHIjklMNOpqrsTUVwxyz
  5. Save this token for your environment configuration

Getting Your Chat ID

For Personal Notifications

  1. Search for @userinfobot on Telegram
  2. Start a conversation with it
  3. It will reply with your user ID (a number like 123456789)

For Group Notifications

  1. Add your bot to the group
  2. Send a message in the group
  3. Visit https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
  4. Look for the chat object and find the id field (it will be negative for groups, like -123456789)

For Channel Notifications

  1. Add your bot as an administrator to the channel
  2. Use the channel's username with an @ prefix (e.g., @mychannel)
  3. Or use the channel ID (find it using the getUpdates method after posting)

Configuration

Add these environment variables to your .env file:

Setting Up the Scheduler

The package provides an artisan command that monitors your log file. You need to schedule it to run periodically.

Laravel 11+ (routes/console.php)

Laravel 10 (app/Console/Kernel.php)

Make sure your server's cron is set up to run Laravel's scheduler:

Artisan Command

Basic Usage

Command Options

Option Description
--log-path Path to log file (default: storage/logs/laravel.log)
--levels Comma-separated log levels to monitor (default: from config)
--dry-run Parse and display errors without sending to Telegram
--reset Reset the file position tracker

Configuration Options

Option Default Description
bot_token '' Your Telegram bot token from BotFather
chat_id '' The Telegram chat/group/channel ID to send messages to
project_name APP_NAME Project name displayed in notifications
environment APP_ENV Environment name displayed in notifications
notify_environments ['production', 'staging'] Only send notifications in these environments
throttle 60 Seconds to wait before sending duplicate messages
log_path storage/logs/laravel.log Path to the log file to monitor
monitor_levels ERROR,CRITICAL,ALERT,EMERGENCY Log levels to monitor
position_storage cache Where to store file position (cache or file)

How It Works

  1. The telegram:monitor-log command runs on a schedule (e.g., every minute)
  2. It reads laravel.log from the last saved position
  3. Parses new content for log entries matching configured levels (e.g., .ERROR)
  4. Sends Telegram notifications for each matching entry
  5. Saves the new file position to avoid re-processing
  6. Automatically detects log rotation and resets position

Log Level Emojis

Messages are prefixed with emojis for quick visual identification:

Level Emoji
Emergency 🆘
Alert 🔔
Critical 🔴
Error 🚨
Warning âš ī¸
Notice 📝
Info â„šī¸
Debug 🔍

Example Message

Testing

To test if your configuration is working:

Security

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-telegram-logger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nwservices/laravel-telegram-logger contains the following files

Loading the files please wait ...