Skip to content

soroush-app/bot-php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Soroush Messenger Bot PHP SDK

Soroush Messenger Bot Wrapper for PHP

Dependencies

  • PHP 5.6+
  • JSON Extension (php-json)
  • cURL Extension (php-curl)

Installation

Run the below commands

git clone https://github.com/soroush-app/bot-php-sdk
cd bot-php-sdk
composer install

Usage

require dirname(__FILE__) . '/vendor/autoload.php';

$bot_token = 'your-bot-token';
$bot = new Soroush\Client($bot_token);
try {
    $to = 'bot user id';
    list($error, $success) = $bot->sendText($to, 'Sample text');
    if($success) {
        echo 'Message sent successfully' . PHP_EOL;
    } else {
        echo 'Fail : ' . $error. PHP_EOL;
    }
} catch (Exception $e) {
    die($e->getMessage());
}

More examples are in the examples folder.

Contribute

Contributions to the package are always welcome!