PHP code example of californiamountainsnake / longmantelegrambot-inlinecalendar

1. Go to this page and download the library: Download californiamountainsnake/longmantelegrambot-inlinecalendar 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/ */

    

californiamountainsnake / longmantelegrambot-inlinecalendar example snippets



class TestCommand extends BaseUserCommand
{
    use InlineCalendar;
}


class TestCommand extends BaseUserCommand
{
    use InlineCalendar;
    
    private function getCalendarConfig(): CalendarConfig
    {
        $min = [2019, 8, 28];
        $max = [2037, 12, 31];
        $def = $min;
        return new CalendarConfig('Date selection', $min, $max, $def);
    }
}


class TestCommand extends BaseUserCommand
{
    use InlineCalendar;
    
    public function execute(): ServerResponse
    {
        // Conversation start
        $this->startConversation();

        $isSelected = $this->selectDate($this->getCalendarConfig(), 'Please select the date:', $this->getMessage());
        if (!$isSelected) {
            return $this->emptyResponse();
        }
        
        $msg = $this->sendTextMessage (\print_r($this->getCalendarDate($this->getCalendarConfig()), true));
        $this->stopConversation();
        return $msg;
    }
}