承接 mmae/phones 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mmae/phones

最新稳定版本:1.0.0

Composer 安装命令:

composer require mmae/phones

包简介

Phone class that make dealing with phone numbers easy

README 文档

README

laravel package to make interact with phone number easier

1. Supported Countries

    * Egypt (EG)
    * Soudi Arabia (KSA)
    * Lybia (LY)
    * Qtar (QT)
    * Oman (OM)
    * Arab Emirates (AU)
    * Bahrain (BH)
    * kwit (KW)

2. Installation

    composer require mmae/phones

3. Usage

- validate the number before saving the record

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

- validate the number before sending sms if you supporting multiple country registration

    
    $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()

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-12