PHP code example of wasenderapi / wasenderapi-laravel
1. Go to this page and download the library: Download wasenderapi/wasenderapi-laravel 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/ */
wasenderapi / wasenderapi-laravel example snippets
$client = new WasenderClient('your_api_key_here');
use WasenderApi\WasenderClient;
public function send(WasenderClient $client) {
$client->sendText('1234567890', 'Hello from Laravel!');
}
use WasenderApi\Facades\WasenderApi;
WasenderApi::sendText('1234567890', 'Hello via Facade!');
use WasenderApi\Data\SendTextMessageData;
use WasenderApi\Data\RetryConfig;
use WasenderApi\Facades\WasenderApi;
$dto = new SendTextMessageData('1234567890', 'Hello DTO!');
$retry = new RetryConfig(true, 3); // Enable retry, max 3 times
WasenderApi::sendText($dto, null, [], $retry);
use WasenderApi\Events\MessagesUpserted;
Event::listen(MessagesUpserted::class, function ($event) {
// $event->payload
});