Official Laravel SDK
The official PingoLine Laravel SDK provides seamless integration for automated order confirmation phone calls, SMS gateway, Click-to-Call, and HMAC-SHA256 webhook verification.
- Packagist: pingoline/laravel-sdk
- GitHub: sakifistiak/pingoline-laravel-sdk
- Requirements: PHP 8.1+ & Laravel 10, 11, or 12
Installation
bash
composer require pingoline/laravel-sdkPublish the config file:
bash
php artisan vendor:publish --tag="pingoline-config"Configuration
Add your credentials to your .env file:
env
PINGOLINE_API_KEY="your_api_token_here"
PINGOLINE_API_URL="https://pingoline.com/api/v1"
PINGOLINE_WEBHOOK_SECRET="your_webhook_secret_here"Usage
Order Confirmation Calls
php
use PingoLine\Laravel\Facades\PingoLine;
$call = PingoLine::createOrderCall([
'phone' => '01712345678',
'order_id' => 'ORD-98421',
'customer_name' => 'Rahim Ahmed',
'amount' => 1450.00,
'language' => 'bn', // 'bn' or 'en'
'send_sms' => true,
]);SMS Messaging
php
// Single / OTP SMS
PingoLine::sendSms('01700000000', 'Your OTP is 123456', 'otp');
// Bulk SMS
PingoLine::sendBulkSms(['01700000000', '01800000000'], 'Weekend Offer!');Click-to-Call (Originate)
php
PingoLine::originateCall(
extension: '101', // PBX Extension
phone: '01712345678' // Customer number
);Webhook Handling
php
use Illuminate\Http\Request;
use PingoLine\Laravel\Facades\PingoLine;
Route::post('/webhooks/pingoline', function (Request $request) {
$event = PingoLine::constructEventFromRequest($request);
if ($event->isOrderCallCompleted()) {
if ($event->isConfirmed()) {
Order::where('id', $event->getOrderId())->update(['status' => 'confirmed']);
} elseif ($event->isCancelled()) {
Order::where('id', $event->getOrderId())->update(['status' => 'cancelled']);
}
}
return response()->json(['received' => true]);
});