1. Go to this page and download the library: Download roomies/phonable 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/ */
roomies / phonable example snippets
// Return an instance of \Roomies\Phonable\Identification\IdentificationResult
$result = Identification::get('+12125550000');
use Roomies\Phonable\Facades\Identification;
use Roomies\Phonable\Contracts\PhoneIdentifiable;
class User implements PhoneIdentifiable
{
/**
* The identifiable phone number in E.164 format.
*/
public function getIdentifiablePhoneNumber(): ?string
{
return '+12125550000';
}
}
// Return an instance of \Roomies\Phonable\Identification\IdentificationResult
$result = Identification::get($user);
use Roomies\Phonable\Facades\Identification;
Identification::driver('prelude')->get($user);
// Return an instance of \Roomies\Phonable\Verification\VerificationRequest
$request = Verification::send('+12125550000');
// Return an instance of \Roomies\Phonable\Verification\VerificationResult
$result = Verification::verify($request->id, 'code');
use Roomies\Phonable\Facades\Verification;
use Roomies\Phonable\Contracts\PhoneIdentifiable;
class User implements PhoneVerifiable
{
/**
* The verifiable phone number in E.164 format.
*/
public function getVerifiablePhoneNumber(): ?string
{
return '+12125550000';
}
/**
* The current verification session identifier.
*/
public function getVerifiableSession(): ?string
{
return $this->phone_verification_session;
}
}
// Return an instance of \Roomies\Phonable\Verification\VerificationRequest
$request = Verification::send($user);
$user->update([
'phone_verification_session' => $request->id,
]);
use Roomies\Phonable\Verification\VerificationResult;
// Return an instance of \Roomies\Phonable\Verification\VerificationResult
$result = Verification::verify($user, 1234);
if ($result === VerificationResult::Successful) {
$user->update([
'phone_verified_at' => now(),
'phone_verification_session' => null,
]);
}
use Roomies\Phonable\Facades\Verification;
Verification::driver('prelude')->send($user);