Download the PHP package jpblu/telegram-error-notifier without Composer
On this page you can find all versions of the php package jpblu/telegram-error-notifier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jpblu/telegram-error-notifier
More information about jpblu/telegram-error-notifier
Files in jpblu/telegram-error-notifier
Package telegram-error-notifier
Short Description A PHP library for sending alert messages to a Telegram bot. Compatible with Laravel.
License MIT
Informations about the package telegram-error-notifier
Telegram Error Notifier
A PHP library for sending alert messages to a Telegram bot. Compatible with Laravel.
Installation
You can install the package using Composer:
Telegram Setup
- Create a Telegram bot.
- Get the bot token.
- Create a private or public channel.
- Add your bot as an admin of the channel.
- Get the channel ID (prefix with
@
if it's a public channel or use the numeric ID for private ones).
Note: Refer to Telegram Bot documentations for further instructions.
Usage (PHP projects)
Usage (Laravel project)
This library automatically registers a Service Provider and Facade if used in a Laravel project.
Configuration
-
Add environment variables to your
.env
file: - Add to
config/services.php
Examples
Send an error message inside a try/catch
block
Notify errors inside a queued Job
Catch all unhandled exceptions in the global Exception Handler
Edit your app/Exceptions/Handler.php
file:
Manual notification
Returned Values
The send()
method returns an array with the response from the Telegram API (or an error if applicable).
Example:
Laravel Compatibility
This package has been tested and works with the following Laravel versions:
- Laravel 8.x
- Laravel 9.x (LTS)
- Laravel 10.x (LTS)
- Laravel 11.x
Laravel 5.5+ may also work, as this package uses automatic service provider registration via Composer.
Acknowledgments
- GuzzleHTTP for client connection
- PHPUnit for testing suite