PHP code example of mmae / phones

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

    

mmae / phones example snippets



use Illuminate\Http\Request;
use MMAE\Phones\EGPhone;
class  UserController  extends App\Http\Controllers\Controller {
    function store(Request $request) {
        $data = $request->validate([
            'name' => ' ])
        }
        $data ['name'] = $phone; // if you save the full version of the number
        \App\Models\User::create($data);
        return back()->with('success','created')
    }   
}

    
    $phone = \MMAE\Phones\Phone::make($user->phone, $user->country_code)
    if($phone->isNotValid()){
        throw new Exception('wrong format')
    }
    $SMSService ->message('hello')->to($phone->withPlus())->send()