PHP code example of arendach / vodafone-msisdn

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

    

arendach / vodafone-msisdn example snippets


\Arendach\VodafoneMsisdn\Providers\MsisdnServiceProvider::class,


$msisdn = 'xO6843saKpzFW9JF8hMzEA==';
$hmac = 'ihzkBF1kq/g/yCRZ/0mZatgWnrY9LmK3RoGgHk7Hqss=';

// initialize msisdn
$msisdnService = new \Arendach\VodafoneMsisdn\Msisdn();

// get phone number without caching
$phone = $msisdnService->decrypt($msisdn, $hmac);

// decrypt and save to cache + get phone and status
$msisdnService->decryptAndSave($msisdn, $hmac); // method decryptAndSave return decrypted phone or null
$phone = $msisdnService->getPhone();
$status = $msisdnService->getStatus();

// using save phone from other 
$msisdnService->setPhone('380666817731');
$phone = $msisdnService->getPhone();

echo $phone; // 380666817731
echo $status; // -1 | 1


$encryptor = new \Arendach\VodafoneMsisdn\Services\Encrypt();
$phone = '38066681731';
$encrypter->make($phone);

$msisdn = $encrypter->getMsisdn(); // xO6843saKpzFW9JF8hMzEA==
$hmac = $encrypter->getHmac(); // ihzkBF1kq/g/yCRZ/0mZatgWnrY9LmK3RoGgHk7Hqss=

$ php artisan vendor:publish --tag=vodafone-msisdn