PHP code example of rabotaru / zagruzka-connector

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

    

rabotaru / zagruzka-connector example snippets


    use RabotaRu\ZagruzkaConnector\Factory;
    use RabotaRu\ZagruzkaConnector\SMSSender;
    
    //Обычно CollectorRegistry у вас уже есть, вам надо получить его из вашего фреймворка.
    $registry = new \Prometheus\CollectorRegistry(
        new \Prometheus\Storage\APC(),
        false
    );
    
    //Получим стандартный коннектор
    $connector = (new Factory())->defaultConnector(
        "https://zagruzka.com/api",
        "zagruzka_sender",
        $registry
    );
     
     //И теперь сам отправщик
    $sender = new SMSSender(
        $connector,
        "login",
        "password",
        "MyService", //то, что будет отображаться как отправитель в СМС
        "https://myservice.com/callback_for_sms" //сюда будут приходить отчеты о доставке
    ); 
    
    $sender->sendSMS("+79261234567", "Test SMS");
    

new Request(
            $id,
            $this->login,
            $this->password,
            $destAddr,
            new RequestMessage(
                new RequestMessageType(),
                new RequestMessageData(
                    $text,
                    $this->serviceName
                )
            ),
            "https://myservice.com/callback_for_sms"
        );