Download the PHP package wramirez83/telegram without Composer
On this page you can find all versions of the php package wramirez83/telegram. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wramirez83/telegram
More information about wramirez83/telegram
Files in wramirez83/telegram
Package telegram
Short Description Laravel 12 compatible library for sending Telegram messages, including texts and files
License MIT
Informations about the package telegram
Telegram Bot API Library for Laravel 12
Librería PHP compatible con Laravel 12 para enviar mensajes y archivos a través de la API de Telegram Bot.
Requisitos
- PHP >= 8.2
- Laravel >= 12.0
- Composer
Instalación
Si estás usando Laravel, publica el archivo de configuración:
Configuración
Agrega las siguientes variables de entorno en tu archivo .env:
O configura en config/telegram.php:
Métodos Disponibles
Información del Bot
getMe()
Obtiene información básica sobre el bot.
Mensajes
sendMessage($message, $chatId = '', $mode = 'Markdown')
Envía un mensaje de texto a un chat.
Parámetros:
$message(string): El mensaje a enviar$chatId(string|int, opcional): ID del chat destino. Si está vacío, usa el canal por defecto$mode(string, opcional): Modo de parseo. Valores:'Markdown','HTML','MarkdownV2'
forwardMessage($chatId, $fromChatId, $messageId, $disableNotification = false)
Reenvía un mensaje de cualquier tipo.
Archivos y Medios
sendPhoto($file, $message = '', $chatId = '')
Envía una foto.
sendDocument($file, $message = '', $chatId = '')
Envía un documento.
sendAudio($audio, $caption = '', $chatId = '', $duration = null, $performer = null, $title = null)
Envía un archivo de audio.
sendVideo($video, $caption = '', $chatId = '', $duration = null, $width = null, $height = null)
Envía un video.
sendVoice($voice, $caption = '', $chatId = '', $duration = null)
Envía un mensaje de voz.
sendSticker($sticker, $chatId = '')
Envía un sticker (.webp).
Ubicación
sendLocation($latitude, $longitude, $chatId = '', $horizontalAccuracy = null, $livePeriod = null, $heading = null, $proximityAlertRadius = null)
Envía un punto en el mapa.
Acciones del Chat
sendChatAction($action, $chatId = '')
Indica al usuario que algo está pasando del lado del bot.
Acciones válidas:
typing- Escribiendoupload_photo- Subiendo fotorecord_video- Grabando videoupload_video- Subiendo videorecord_voice- Grabando audioupload_voice- Subiendo audioupload_document- Subiendo documentofind_location- Buscando ubicaciónrecord_video_note- Grabando nota de videoupload_video_note- Subiendo nota de video
Actualizaciones y Webhooks
getUpdate($offset = null, $limit = null, $timeout = null, $allowedUpdates = null)
Obtiene actualizaciones del bot.
setWebhook($url, $certificate = null, $ipAddress = null, $maxConnections = null, $allowedUpdates = null, $dropPendingUpdates = false, $secretToken = null)
Configura un webhook para recibir actualizaciones.
removeWebhook($dropPendingUpdates = false)
Elimina el webhook configurado.
Archivos
getFile($fileId)
Obtiene información sobre un archivo.
getFileUrl($fileId)
Obtiene la URL completa para descargar un archivo.
Perfil de Usuario
getUserProfilePhotos($userId, $offset = 0, $limit = 100)
Obtiene las fotos de perfil de un usuario.
Utilidades
curFile($routeFile)
Crea un objeto CURLFile para subir archivos.
Ejemplos Completos
Enviar mensaje con formato
Enviar múltiples archivos
Manejar actualizaciones
Compatibilidad con Laravel 12
Esta librería es completamente compatible con Laravel 12 y utiliza:
- Sistema de configuración de Laravel
- Soporte para PHP 8.2+
- Estructura compatible con Service Providers de Laravel
Referencias
Licencia
MIT
Autor
Wilson Ramirez Z - [email protected]