1. Go to this page and download the library: Download peyman/bale-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/ */
peyman / bale-sdk example snippets
/**
* SET YOUR TOKEN FOR USE SEND MESSAGE TYPES
*/
$Bale = new \Vicente\Bale\Bale("YOUR TOKEN");
/**
* hears GET TYPE AND USER ID AND ACCESS HASH
*/
$Bale->hears(function($user){
print_r($user);
});
/**
* SET YOUR TOKEN FOR USE SEND MESSAGE TYPES
*
* $property string YOUR TOKEN
*/
$Bale = new \Vicente\Bale\Bale("YOUR TOKEN");
/**
* SET TYPE USER AND ID USER AND ACCESS HASH
*
* $property array TYPE [Group,User]
* $property string ID (user_id get from method hears)
*/
$peerUser = new \Vicente\Bale\Peer\PeerUsers("TYPE","ID","ACCESS HASH");
/**
* GET PARAMS FOR SEND TEXT MESSAGE
*
* $property string YOUR MESSAGE
*/
$textMessage = new \Vicente\Bale\Message\TextMessage('YOUR MESSAGE');
try {
/**
* send METHOD FOR SEND TYPES OF MESSAGE
*/
$send = $Bale->send( $textMessage, $peerUser->getPeer() );
} catch ( \Vicente\Bale\Exception\MessageException $e ) {
return "SERVER ERROR";
}
/**
* SET YOUR TOKEN FOR USE SEND MESSAGE TYPES
*/
$Bale = new \Vicente\Bale\Bale("YOUR TOKEN");
/**
* SET TYPE USER AND ID USER AND ACCESS HASH
*/
$peerUser = new \Vicente\Bale\Peer\PeerUsers("Group","1661462554","-2072671474748044026");
/**
* NEW FILE CLASS FOR SEND FILE OR IMAGE
*/
$file = new \Vicente\Bale\Message\FileMessage();
/**
* sendFiles IS METHOD GET PARAMS FOR USE SEND FILE OR IMAGE
*/
$fileMessage = $file->sendFiles("PATH OF YOUR IMAGE OR YOUR FILE",function ($params) use($Bale,$peerUser){
/**
* send METHOD FOR SEND TYPES OF MESSAGE
*/
$Bale->send($params,$peerUser->getPeer());
},"MESSAGE FOR SEND WITH FILE OR IMAGE");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.