-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
2,638 additions
and
231 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,43 @@ | ||
{ | ||
"name": "mrmuminov/yii2-playmobile-uz", | ||
"description": "Yii2 PlaymobileUz SMS-shlyuz ", | ||
"type": "yii2-extension", | ||
"keywords": ["yii2","extension","sms","shlyuz","send","play","mobile","uz","playmobile","playmobileuz","mrmuminov"], | ||
"license": "Apache-2.0", | ||
"authors": [ | ||
{ | ||
"name": "Bahriddin Mo'minov", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"yiisoft/yii2": "~2.0.0", | ||
"php": "7.*", | ||
"ext-curl": "*" | ||
}, | ||
"minimum-stability": "dev", | ||
"autoload": { | ||
"psr-4": { | ||
"mrmuminov\\yii2playmobileuz\\": "" | ||
} | ||
"name": "mrmuminov/yii2-playmobile-uz", | ||
"description": "Yii2 PlaymobileUz SMS-shlyuz ", | ||
"type": "yii2-extension", | ||
"keywords": [ | ||
"yii2", | ||
"extension", | ||
"sms", | ||
"shlyuz", | ||
"send", | ||
"play", | ||
"mobile", | ||
"uz", | ||
"playmobile", | ||
"playmobileuz", | ||
"mrmuminov" | ||
], | ||
"license": "Apache-2.0", | ||
"authors": [ | ||
{ | ||
"name": "Bahriddin Mo'minov", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "dev", | ||
"require": { | ||
"php": "^8.2", | ||
"ext-curl": "*", | ||
"ext-json": "*", | ||
"yiisoft/yii2": "^2.0.0", | ||
"guzzlehttp/guzzle": "7.7.x-dev" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"mrmuminov\\yii2playmobileuz\\": "src/" | ||
} | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"yiisoft/yii2-composer": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use mrmuminov\yii2playmobileuz\Playmobile; | ||
use yii\console\Application; | ||
|
||
class Yii | ||
{ | ||
public static Application|__Application|\yii\web\Application $app; | ||
} | ||
|
||
class __Application | ||
{ | ||
public Playmobile $playmobile; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** import classes */ | ||
|
||
use mrmuminov\yii2playmobileuz\Playmobile; | ||
use mrmuminov\yii2playmobileuz\types\Messages; | ||
use mrmuminov\yii2playmobileuz\types\Send; | ||
use mrmuminov\yii2playmobileuz\types\Sms; | ||
use mrmuminov\yii2playmobileuz\types\SmsContent; | ||
|
||
/** include autoload files */ | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; | ||
|
||
/** define constant */ | ||
defined('YII_DEBUG') or define('YII_DEBUG', true); | ||
defined('YII_ENV') or define('YII_ENV', 'dev'); | ||
|
||
/** init Yii2 Framework application */ | ||
(new yii\web\Application([ | ||
'id' => 'app-playmobile', | ||
'basePath' => dirname(__DIR__), | ||
'components' => [ | ||
'playmobile' => [ | ||
'class' => Playmobile::class, | ||
'username' => "", | ||
'password' => "", | ||
|
||
] | ||
], | ||
])); | ||
|
||
|
||
try { | ||
|
||
/** Create Send class and set attributes */ | ||
$data = new Send(); | ||
$data->sms = new Sms(); | ||
$data->sms->originator = "3700"; // change, if you need | ||
$data->sms->content = new SmsContent(); | ||
$data->sms->content->text = "Test Message"; | ||
$message = new Messages(); | ||
$message->recipient = '998XXAAABBCC'; // Phone number | ||
$message->messageId = 'unique-id'; // Your application Unique ID | ||
$data->messages = [ | ||
$message | ||
]; | ||
|
||
/** Set attributes with another way */ | ||
// $data = new Send([ | ||
// "sms" => new Sms([ | ||
// "originator" => "3700", | ||
// "content" => new SmsContent([ | ||
// "text" => "Test Message", | ||
// ]), | ||
// ]), | ||
// "messages" => [ | ||
// new Messages([ | ||
// "messageId" => 'unique-id', | ||
// "recipient" => '998XXAAABBCC', | ||
// ]), | ||
// ] | ||
// ]); | ||
|
||
$responseContent = Yii::$app->playmobile->send($data); | ||
// Success | ||
|
||
} catch (Exception $e) { | ||
var_dump($e->getCode()); | ||
var_dump($e->getMessage()); | ||
} |
Oops, something went wrong.