PHP code example of fouladgar / laravel-mobile-verification
1. Go to this page and download the library: Download fouladgar/laravel-mobile-verification 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/ */
fouladgar / laravel-mobile-verification example snippets
namespace App;
use Fouladgar\MobileVerification\Contracts\MustVerifyMobile as IMustVerifyMobile;
use Fouladgar\MobileVerification\Concerns\MustVerifyMobile;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable implements IMustVerifyMobile
{
use Notifiable, MustVerifyMobile;
// ...
}
namespace App;
use Fouladgar\MobileVerification\Contracts\SMSClient;
use Fouladgar\MobileVerification\Notifications\Messages\Payload;
class SampleSMSClient implements SMSClient
{
protected $SMSService;
/**
* @param Payload $payload
*
* @return mixed
*/
public function sendMessage(Payload $payload):mixed
{
// preparing SMSService ...
return $this->SMSService
->send($payload->getTo(), $payload->getToken());
}
// ...
}
// lang/vendor/MobileVerification/en/mobile_verification.php
return [
'successful_verification' => 'Your mobile has been verified successfully.',
'successful_resend' => 'The token has been resent successfully.',
'already_verified' => 'Your mobile already has been verified.',
//etc...
];
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
'Fouladgar\MobileVerification\Events\Verified' => [
'App\Listeners\LogVerifiedUser',
],
];