PHP code example of kkxdev / laravel-truecaller-oauth
1. Go to this page and download the library: Download kkxdev/laravel-truecaller-oauth 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/ */
kkxdev / laravel-truecaller-oauth example snippets
use Kkxdev\Truecaller\Facades\Truecaller;
use Kkxdev\Truecaller\Exceptions\TruecallerException;
try {
$profile = Truecaller::authenticate($authorizationCode, $codeVerifier);
} catch (TruecallerException $e) {
return response()->json(['code' => $e->errorCode()], $e->clientStatus());
}
$profile->phone()->e164(); // "+919876543210"
$profile->phone()->dialCode(); // "91" (bare, never "+91")
$profile->phone()->nationalNumber(); // "9876543210"
$profile->sub(); // stable Truecaller subject id
bash
php artisan vendor:publish --tag=truecaller-config