Последняя версия с сервера прошлого разработчика
This commit is contained in:
9
app/Support/Sms/SmsApi.php
Executable file
9
app/Support/Sms/SmsApi.php
Executable file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support\Sms;
|
||||
|
||||
interface SmsApi
|
||||
{
|
||||
public function sendText($number, $text): void;
|
||||
public function sendCall($number, $ip): void;
|
||||
}
|
||||
39
app/Support/Sms/SmsRu.php
Executable file
39
app/Support/Sms/SmsRu.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support\Sms;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
class SmsRu implements SmsApi
|
||||
{
|
||||
private $appId;
|
||||
private $url;
|
||||
private $client;
|
||||
|
||||
public function __construct($appId, $url = 'https://sms.ru/sms/send')
|
||||
{
|
||||
if (empty($appId)) {
|
||||
throw new \InvalidArgumentException('Sms appId must be set.');
|
||||
}
|
||||
|
||||
$this->appId = $appId;
|
||||
$this->url = $url;
|
||||
$this->client = new Client();
|
||||
}
|
||||
|
||||
public function sendText($number, $text): void
|
||||
{
|
||||
$this->client->post($this->url, [
|
||||
'form_params' => [
|
||||
'api_id' => $this->appId,
|
||||
'to' => '+' . trim($number, '+'),
|
||||
'text' => $text
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function sendCall($number, $ip): void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
13
app/Support/helpers.php
Executable file
13
app/Support/helpers.php
Executable file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
function get_cursor_hash($collectionWithPagination)
|
||||
{
|
||||
if($collectionWithPagination->hasMorePages()){
|
||||
return @explode('cursor=', $collectionWithPagination->nextPageUrl())[1];
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user