PHP code example of telegram-bot-essentials / campaigns

1. Go to this page and download the library: Download telegram-bot-essentials/campaigns 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/ */

    

telegram-bot-essentials / campaigns example snippets


use TelegramBotEssentials\Campaigns\Telegram\ReplyKeys\Admin\CampaignsKey;

'keyboard' => [
    'admin' => [
        // ...
        [CampaignsKey::class],
    ],
],

prizeTypes()->register(new FreeServicePrize);

class FreeServiceForm extends PrizeConfigForm
{
    protected string $type = 'FREE_SERVICE_PRIZE';
    protected string $lang = 'my-package::free_service.wizard';

    protected function prizeTypeKey(): string { return FreeServicePrize::KEY; }
    public function steps(): array { return [/* Choice, Text, ... */]; }
    protected function config(array $answers): array { return ['plan' => $answers['plan']]; }
}