PHP code example of luannsr12 / menuia

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

    

luannsr12 / menuia example snippets


     

    ettings;
    use Menuia\Device;

    Settings::setEndpoint("https://-------");
    Settings::setAuthkey("");
    Settings::setAppkey("NEW_TOKEN"); // novo appkey ou token existente
    
    $qrcode = Device::qrcode(); // irá criar o dispositivo ou buscar o qrcode do dispositivo de 'Settings::setAppkey()'

    var_dump($qrcode);

    /*
     * if(isset($qrcode->status)){
     *  if($qrcode->status == 200){
     *    $id   =  $qrcode->message->id; // id do dispositivo  
     *    $qr   =  $qrcode->message->qr; // qrcode base64
     *  }
     * }
     * 
     */


     

    ettings;
    use Menuia\Device;

    Settings::setEndpoint("https://-------");
    Settings::setAuthkey("");
    Settings::setAppkey("DEVICE_1"); // id ou appKey do dispositivo a ser removido
    
    $remove = Device::remove();

    var_dump($remove);

    /*
     * if(isset($remove->status)){
     *  if($remove->status == 200){
     *     echo 'Removido com sucesso!';
     *  }
     * }
     * 
     */


     

    ettings;
    use Menuia\Device;

    Settings::setEndpoint("https://-------");
    Settings::setAuthkey("");
    Settings::setAppkey("DEVICE_1"); // id ou appKey do dispositivo a ser desconectado
    
    $disconnect = Device::disconnect();

    var_dump($disconnect);

    /*
     * if(isset($disconnect->status)){
     *  if($disconnect->status == 200){
     *     echo 'Desconectado com sucesso!';
     *  }
     * }
     * 
     */


     

    ettings;
    use Menuia\Device;

    Settings::setEndpoint("https://-------");
    Settings::setAuthkey("");
    Settings::setAppkey("DEVICE_1"); // id ou appKey do dispositivo a ser checkado
    
    $status = Device::status(); // case return 'false' is disconnected

    var_dump($status);

    /*
     * if(isset($status->status)){
     *  if($status->status == 200){
     *     echo 'Conectado!';
     *  }
     * }
     * 
     */


 

    ia\Settings;
    use Menuia\Message;

    Settings::setEndpoint("https://-------");
    Settings::setAuthkey("");
    Settings::setAppkey("");

    Message::$phone = "551199999999";
    Message::$message = "Mensagem de teste";
    Message::$type = "text";

    $send = Message::send();

    var_dump($send);


 

    ia\Settings;
    use Menuia\Message;

    Settings::setEndpoint("https://-------");
    Settings::setAuthkey("");
    Settings::setAppkey("");

    Message::$phone     = "551199999999";
    Message::$message   = "Mensagem de teste"; // optional for media. Use as caption
    Message::$type      = "media";
    Message::$file_url  = "https://site.com/img.png"; // doc, image, audio and videos

    $send = Message::send();

    var_dump($send);