moemengaballah / msegat
这是一个用于 msegat 的 Laravel 扩展包。其目标是简化复杂性。
v1.0
2023-10-26 11:18 UTC
README
这是一个用于 msegat 的 Laravel 扩展包。其目标是简化复杂性。
Laravel Msegat 扩展包
这是一个用于 msegat 的扩展包。其目标是简化复杂性。
安装
composer require moemengaballah/msegat
Laravel 使用包自动发现,因此不需要您手动添加 ServiceProvider。
Laravel 版本低于 5.5
如果您不使用自动发现,请将 ServiceProvider 添加到 config/app.php 文件中的 providers 数组中
MoemenGaballah\Msegat\MsegatServiceProvider::class,
如果您想使用外观来记录消息,请将以下内容添加到 app.php 中的外观
'Msegat' => MoemenGaballah\Msegat\Msegat::class,
使用发布命令将包配置复制到本地配置
php artisan vendor:publish --provider="msegat"
用法
您必须首先在文件 env 中添加 API 凭证
MSEGAT_USERNAME= MSEGAT_USER_SENDER= MSEGAT_API_KEY=
示例 OTP
// numbers (required, string, international format without zeros separated by comma, example: "966xxxxxxxxx" or "966xxxxxxxxx,966xxxxxxxxx,966xxxxxxxxx") //Msegat::sendMessage('numbers', 'MSG'); use Msegat; $msg = Msegat::sendMessage('966xxxxxxxxx', 'رمز التحقق: 1234'); dd($msg);
// another example Route::get('/', function () { $msg = Msegat::sendMessage('966xxxxxxxxx', 'رمز التحقق: 1234'); dd($msg); });
如果您没有凭证
This API is based on HTTPS protocol You must have an account to test this API, to register please click here You must use HTTPS POST with parameters in body [ VERY IMPORTANT ] You must use URL ENCODING when you send the variables If SMS is English only, we will charge 1 point for each 160 chars and if you send more than this, we will charge 1 point for each 153 chars If SMS contains language other than English, we will charge 1 point for each 70 chars and if you send more than this, we will charge 1 point for each 67 chars You can test our API for free . You will get free sms every day . To test our service you can send sms using below parameters: userSender: OTP msg: "Pin Code is: xxxx" or "Verification Code: xxxx"
状态码和消息
1 - Success M0000 - Success M0001 - Variables missing M0002 - Invalid login info M0022 - Exceed number of senders allowed M0023 - Sender Name is active or under activation or refused M0024 - Sender Name should be in English or number M0025 - Invalid Sender Name Length M0026 - Sender Name is already activated or not found M0027 - Activation Code is not Correct 1010 - Variables missing 1020 - Invalid login info 1050 - MSG body is empty 1060 - Balance is not enough 1061 - MSG duplicated 1064 - Free OTP , Invalid MSG content you should use "Pin Code is: xxxx" or "Verification Code: xxxx" or "رمز التحقق: 1234" , or upgrade your account and activate your sender to send any content 1110 - Sender name is missing or incorrect 1120 - Mobile numbers is not correct 1140 - MSG length is too long M0029 - Invalid Sender Name - Sender Name should contain only letters, numbers and the maximum length should be 11 characters M0030 - Sender Name should ended with AD M0031 - Maximum allowed size of uploaded file is 5 MB M0032 - Only pdf,png,jpg and jpeg files are allowed! M0033 - Sender Type should be normal or whitelist only M0034 - Please Use POST Method M0036 - There is no any sender