This repository is a boilerplate for development of the php-telegram-bot.

Overview
Table of Contents
  1. About this repository
  2. Getting Started
  3. Using Docker
  4. Using the bot

About this repository

This repository is a boilerplate for development of the php-telegram-bot.

(back to top)

Getting Started

Cloning the repository

git clone --recurse-submodules https://github.com/php-telegram-bot/workspace.git

After cloning the workspace, you can use the workspace as if it were a project. We provided a few scripts and a docker-compose.yml that configures a webserver and a local Telegram Bot API server for using and testing webhooks.

Working on php-telegram-bot

To work on the php-telegram-bot repository itself you need to cd into the packages/php-telegram-bot directory and checkout a branch with

git checkout develop

To pull all the current changes from upstream you can call from any location

git submodule update --remote --merge

If you want to commit changes to upstream, you can simply do that as anywhere else.

(back to top)

Using Docker

By default the Docker setup launches preconfigured with the following containers:

  1. nginx Webserver
    • to accept webhook calls from the custom bot api server
  2. php-fpm PHP 8.1
    • runs all the code
  3. mariadb Database
    • already has the structure imported
  4. tdlight Custom Bot API Server
    • Lighter version of the custom Telegram bot API server.

To start the container copy the .env.example into a .env file and fill out your TELEGRAM_API_ID and TELEGRAM_API_HASH data from https://my.telegram.org/apps.

After this you can start the containers with

docker-compose up -d

(back to top)

Using the bot

By default there is a /start command.

So if you've also filled out your TELEGRAM_BOT_USERNAME and TELEGRAM_BOT_TOKEN in your .env file, you can execute the setWebhook.php inside the php Docker container.

If successful, you should be able to send a /start to your bot.

(back to top)

Manually calling the webserver

If you need to call the webserver directly or have a look at the stats of the Bot API server you can create a docker-compose.override.yml file and add the needed port forwarding like in this example:

version: '3'
services:
  nginx:
    ports:
      - 8080:80
        
  api-server:
    environment:
      TELEGRAM_STAT: yes
    ports:
      - 8082:8082

The first block inside services extends the nginx service and adds a port forwarding from 8080 (on your host) to 80 inside the container. You can then call any php script or static files with http://localhost:8080

The second block extends the api-server service, enables the stats with an environment variable and forwards the port 8082 from the container to your host. This allows you to call http://localhost:8082 to access the stats page of the Telegram Bot API server and check i.e. if the webhook was registered correctly.

You might also like...
PocketMine-MP plugin for add a "hacker" difficulty bot.

NoDebuffBot NoDebuffBot is a open source plugin for PocketMine-MP. SetUP Put this plugin con your plugins folder. Create a world called ndfbot and exe

My Personal Bot

Rosebot My personal chat bot Query JSON Query { "query": { "sender": "sumith", "message": "hi" } } Query Command curl -s -X POST http:/

ddos botnet in the telegram robot - اجرای حملات دیداس با استفاده از بات نت و کنترل در تلگرام
ddos botnet in the telegram robot - اجرای حملات دیداس با استفاده از بات نت و کنترل در تلگرام

ddos botnet in the Telegram ⚠️ هشدار: مسئولیت استفاده نادرست از این اسکریپت بر عهده شخص خواهد بود و حمله ddos در تمامی کشور ها جرم است ، لذا از حمله ب

Ele é voltado para gerar infinitas CC de 23 países A ferramenta ainda esta em BETA então terá muitas Novas atualizações incríveis acompanhem melhor No meu canal do telegram: https://t.me/MS40_canal

BlackBIN 💳 👨‍💻 Olá pessoal sou eu o maycon ou como vcs me chamam, MS40 ou BLACK_HYDRA. Então esse script foi o um projeto muito antigo Que só esta

Simple PHP Pages - A simple puristic PHP Website Boilerplate
Simple PHP Pages - A simple puristic PHP Website Boilerplate

Simple PHP Pages - A simple puristic PHP Website Boilerplate 🚀 Hey! This project provides simple and basic concepts for PHP pages. It includes ideas

Tiny, fast and simple PHP boilerplate built on top of FlightPHP

BlessPHP Tiny, fast and simple PHP boilerplate built on top of FlightPHP. Good enough to use as skeleton for prototypes and some pet-projects. The nam

Learn how to run WordPress with Docker. Read about our experiences and start off with an easy boilerplate.
Learn how to run WordPress with Docker. Read about our experiences and start off with an easy boilerplate.

Hi! We're Dan and Jay. We're a two person team with a passion for open source products. We created Server Side Up to help share what we learn. Find us

Wordpress Plugin Boilerplate but Powered with examples and a generator!
Wordpress Plugin Boilerplate but Powered with examples and a generator!

WordPress Plugin Boilerplate Powered WordPress Plugin Boilerplate Powered is a complete foundation for building your WordPress plugins following PSR-4

A htaccess boilerplate for all Magento Community installations. Features focus on speed, SEO and security.

magento-htaccess A htaccess boilerplate for all Magento Community installations. Features focus on speed, SEO and security. The file should be placed

Comments
  • Call setWebhook.php in php entrypoint

    Call setWebhook.php in php entrypoint

    Currently you need to call setWebhook manually. But if you start the docker stack, we could automate that step to make it even easier to use it.

    So I'd like to create a custom entrypoint script for the php container, that calls the setWebhook with the default config automatically on startup.

    opened by TiiFuchs 1
Owner
PHP Telegram Bot
PHP Telegram Bot framework/library
PHP Telegram Bot
Bot Telegram sederhana dengan bahasa PHP untuk membantu proses pendaftaran

Bot Pendaftaran Bot Telegram sederhana dengan bahasa PHP untuk membantu proses pendaftaran Syarat pakai Di komputer harus sudah terinstal PHP dan Git

Danns Bass 2 Sep 25, 2021
Run Telegram PHP Bot on Windows Localhost without Host or VPN.

Run Telegram PHP Bot on Windows Localhost without Host or VPN.

iNeoTeam | آی نئو 4 May 30, 2022
a Telegram bot to fetch download link from pan.baidu.com

baiduwp-bot a Telegram bot to fetch download link from pan.baidu.com What it can do Get a file download link from share link. 从分享链接获取下载地址 How to use G

Yuan_Tuo 23 Dec 3, 2022
A Telegram CC Checker Bot with hella lotta features.

SDMN CC Checker Bot A Telegram CC Checker Bot with hella lotta features. ?? Features Admin Panel Ban a user Unban a user Mute a user Unmute a user Che

iNaveen 192 Jan 8, 2023
Laravel boilerplate with the best development practices.

Laravel Boilerplate Introduction ?? Welcome to Laravel Init - a boilerplate for installing laravel application. It covers: One-liner shell script to s

ColoredCow 7 Dec 29, 2021
A bot written in PHP which attempts to link IRC with SQL database, allowing for integration between platforms

Valeyard IRC-SQL-GateWay A bot written in PHP which attempts to link IRC with SQL database, allowing for integration between platforms. This bot is mo

Valerie Pond 10 Oct 6, 2022
Simple customizable captcha script for bot prevention in php language.

phpCaptcha Simple customizable captcha script for bot prevention in php language. Usage <?php session_start(); $status = ""; if ($_SESSION['captcha']

Филип Арсовски 11 Oct 10, 2022
A Twitter bot powered by Github Actions tweeing Wikidata milestones

Twitter WikidataMeter Bot I'm the code, and deployment of Twitter bot WikidataMeter. I tweet a few fun things about Wikidata as it grows. Tweets Feel

null 9 Dec 9, 2022
Jéssica Paula 7 Aug 12, 2022
Sri Lanka Grade Exam Results Bot 📚 can collect Grade 5 O/L A/L Exam Results 📚 in Second Powerd By Sri lanka Department Of Examination 🚀

Sri-Lanka-Exam-Results-Telegram-Bot How to use the bot /start : Start Sri Lanka Grade 5 O/L A/L Exam Results Bot. /help : More information about Sri L

GD Hiruna 8 Oct 2, 2022