PHP code example of mildberry / notifier

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

    

mildberry / notifier example snippets

 php


use Mildberry\Notifier\Interfaces\SmsNotifyInterface;
use Mildberry\Notifier\Notifier;
use Mildberry\Notifier\Notify\NotifyCollection;
use Mildberry\Notifier\Notify\SmsNotify;
use Mildberry\Notifier\Transport\VarDumpTransport;

>push(new SmsNotify('79136703311', 'How a you?'))
    ->push(new SmsNotify('79136703311', 'Where are you?'));

$notifier->sendCollection($collectionSms);

 php


use Mildberry\Notifier\Interfaces\SmsNotifyInterface;
use Mildberry\Notifier\Notifier;
use Mildberry\Notifier\Notify\Notify;
use Mildberry\Notifier\Transport\VarDumpTransport;

Body('Your activation code is '.$code)
        ;
    }
}

class RegistrationCompleteSms extends Notify implements SmsNotifyInterface
{
    public function __construct($phone)
    {
        $this
            ->setRecipient($phone)
            ->setBody('Congratulations registration is completed')
        ;
    }
}

$notifier = new Notifier();
$notifier->setNotifyTransport(SmsNotifyInterface::class, (new VarDumpTransport()));

// ... registration process

$notifier->send(new ActivationSms('79136703311', rand(1, 9999)));

// ... registration complete

$notifier->send(new RegistrationCompleteSms('79136703311'));