PHP code example of ankurk91 / laravel-vonage-inbound-sms
1. Go to this page and download the library: Download ankurk91/laravel-vonage-inbound-sms 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/ */
ankurk91 / laravel-vonage-inbound-sms example snippets
protected $except = [
'/webhooks/*',
];
namespace App\Jobs\Webhook\Vonage\SMS\Inbound;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\SerializesModels;
use Spatie\WebhookClient\Models\WebhookCall;
class TextSMSJob implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels;
public function __construct(protected WebhookCall $webhookCall)
{
//
}
public function handle()
{
$message = new \Vonage\SMS\Webhook\InboundSMS($this->webhookCall->payload);
// todo do something with $message
}
}
namespace App\Listeners\Vonage\SMS\Inbound;
use Illuminate\Contracts\Queue\ShouldQueue;
use Spatie\WebhookClient\Models\WebhookCall;
class UnicodeSMSListener implements ShouldQueue
{
public function handle(WebhookCall $webhookCall)
{
$message = $webhookCall->payload;
// todo do something with $message
}
}
use Illuminate\Database\Console\PruneCommand;
use Spatie\WebhookClient\Models\WebhookCall;
$schedule->command(PruneCommand::class, [
'--model' => [WebhookCall::class]
])
->onOneServer()
->daily()
->description('Prune webhook_calls.');