1. Go to this page and download the library: Download laratusk/cloudflare-tunnel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
laratusk / cloudflare-tunnel example snippets
namespace App\Listeners;
use Laratusk\CloudflareTunnel\Events\TunnelConnected;
use Telegram\Bot\Laravel\Facades\Telegram;
class RegisterTelegramWebhook
{
public function handle(TunnelConnected $event): void
{
Telegram::setWebhook(['url' => $event->url . '/api/telegram/webhook']);
}
}
namespace App\Listeners;
use Laratusk\CloudflareTunnel\Events\TunnelDisconnected;
use Telegram\Bot\Laravel\Facades\Telegram;
class RemoveTelegramWebhook
{
public function handle(TunnelDisconnected $event): void
{
Telegram::deleteWebhook();
}
}