PHP code example of oncology-support / amazon-sms-helper-bundle

1. Go to this page and download the library: Download oncology-support/amazon-sms-helper-bundle 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/ */

    

oncology-support / amazon-sms-helper-bundle example snippets


// config/bundles.php

return [
    // ...
    OncologySupport\AmazonSMSHelper\OncologySupportAmazonSMSHelperBundle::class => ['all' => true],
];


use Aws\Result
use OncologySupport\AmazonSMSHelper\Service\AmazonSMSHelper;

class ExampleSmsService
{
    public function __construct(private readonly $smsHelper)
    {
    }

    public function sendSMS(string $message, string $phoneNumber): Result
    {
        // cellPhoneNumber must be in the format +1XXXXXXXXXX (for US numbers)
        $cellPhoneNumber = '+1' . preg_replace("/[^0-9]+/", "", $phoneNumber);
        
        return $this->smsHelper($message, $cellPhoneNumber);
    }
}