1. Go to this page and download the library: Download taddy/taddy-sdk 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/ */
taddy / taddy-sdk example snippets
use Taddy\Sdk\Taddy;
$taddy = new Taddy(pubId: 'bot-xxxxxxxxxxxxxx', new TaddyOptions(
token: '123456780:yyyyyyyyyyyyyyyyyy', // Your bot's token
));
use Taddy\Sdk\Dto\User as TaddyUser;
$user = TaddyUser::factory($tgUserId)
->withUsername($tgUsername)
->withFirstName($tgFirstName)
// other stuff
;
$taddy->start(
user: $user, // User DTO
start: $startMessage // text from update with /start command
);
$ads = $taddy->ads();
// Retrieve ad for $user
$ad = $ads->getAd($user);
// Ad exists, showtime!
if ($ad) {
$ads->show($ad, $user);
}
// Retrieve ad for $user
$ad = $ads->getAd($user);
// Ad exists, showtime!
if ($ad) {
// show $ad
myShowAdFuncation($ad); // your custom method
// send imoressions event
$ads->impressions($user, $ad->id);
// show ad delay 15 sec.
sleep(15);
// hide $ad (delete message)
myHideAdFuncation($ad); // your custom method
}