PHP code example of escolalms / templates-sms

1. Go to this page and download the library: Download escolalms/templates-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/ */

    

escolalms / templates-sms example snippets


Sms::driver('twilio')->send('123456789', 'SMS message');

Sms::send('123456789', 'SMS message');

interface SmsDriver
{
    public function send(string $to, string $content, array $mediaUrls = [], array $params = []): bool;
}

class CustomDriver implements \EscolaLms\TemplatesSms\Drivers\Contracts\SmsDriver
{
    public function send(string $to, string $content, array $mediaUrls = [], $params = []): bool
    {
        // Implement send() method.
    }
}

Sms::extend('custom', function($app) {
    return new CustomDriver($app);
});

public function testSms() {
    Sms::fake();
    ...
    $service->sendSms($phone1);
    ...
    Sms::assertSent($phone1);
    Sms::assertNotSent($phone2);
}

public function testSms() {
    Sms::fake();
    ...
    Sms::assertSent($phone1, fn($sms) => $sms->content === 'Sms message');
}