restore composer.json, add mysqli extension

This commit is contained in:
2026-04-15 17:02:52 +05:00
commit 77cf56a348
4317 changed files with 1397107 additions and 0 deletions

52
app/Api/Firebase.php Executable file
View File

@@ -0,0 +1,52 @@
<?php
namespace App\Api;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
class Firebase
{
protected $client;
protected $token = 'token';
public function __construct()
{
$this->client = new Client();
}
/**
* @param $notification
* @param $tokens
* @return \Exception|ClientException|\Psr\Http\Message\StreamInterface
*/
public function send_notification($notification, $tokens)
{
$url = 'https://fcm.googleapis.com/fcm/send';
$fields = [
// "priority"=>"high",
"registration_ids" => $tokens,
'notification' => $notification,
'data' => $notification,
//'content-available' => true,
'priority' => 'high'
];
$headers = [
"Authorization" => "key={$this->token}",
'Content-Type' => 'application/json',
];
try {
$request = $this->client->post($url, [
'headers' => $headers,
'json' => $fields,
]);
$response = $request->getBody();
return $response;
} catch (ClientException $exception) {
return $exception;
}
}
}

60
app/Api/ImageResize.php Executable file
View File

@@ -0,0 +1,60 @@
<?php
namespace App\Api;
use Carbon\Carbon;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\Facades\Image as Imagee;
class ImageResize
{
/**
* @param string $type
* @return string
*/
private function mkdir(string $type)
{
$folder = Carbon::now()->format('Y/m/d');
$path = "uploads/{$type}/thumbs/{$folder}";
if (!file_exists($path)) {
mkdir($path, 0755, true);
}
return $path;
}
/**
* @param $path
* @param $size
* @param $type
* @return string
*/
public function resize($path, $size, $type)
{
$name = basename($path);
$folder = $this->mkdir($type);
$path_thumb = "{$folder}/{$name}";
if (env('FILESYSTEM_DISK') == 's3') {
try{
$file = Storage::disk("public")->get($path);
}catch(Exception $e){
$file = file_get_contents($path);
}
$img = Imagee::make($file);
$img->resize($size, null, function ($constraint) {
$constraint->aspectRatio();
});
// delete temp file
$img->save("{$path_thumb}", 100);
Storage::disk('s3')->put($path_thumb, file_get_contents($path_thumb));
} else {
$img = Imagee::make(public_path($path));
$img->resize($size, null, function ($constraint) {
$constraint->aspectRatio();
});
$img->save(public_path() . "/{$path_thumb}", 100);
}
return $path_thumb;
}
}

103
app/Api/Sms.php Executable file
View File

@@ -0,0 +1,103 @@
<?php
namespace App\Api;
use GuzzleHttp\Client;
class Sms
{
const URL = '';
const ORIGINATOR = '';
protected $client;
public function __construct()
{
$this->client = new Client();
}
public function send(int $phone, string $message)
{
$data = [
'messages' => [
[
'recipient' => $phone,
'message-id' => time(),
'sms' => [
'originator' => '3700',
'content' => [
'text' => $message
]
]
]
]
];
$data_string = json_encode($data);
$username = env("SMS_USERNAME");
$password = env("SMS_PASSWORD");
$url = env('SMS_URL');
$debug = [
'ok' => false,
'url' => $url,
'username' => $username,
'phone' => $phone,
];
if (!$url || !$username || !$password) {
$debug['error_stage'] = 'env_missing';
$debug['missing'] = [
'SMS_URL' => (bool)$url,
'SMS_USERNAME' => (bool)$username,
'SMS_PASSWORD' => (bool)$password,
];
return $debug;
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 25);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
[
'Content-Type: application/json',
'Accept: application/json',
'Content-Length: ' . strlen($data_string),
]
);
$result = curl_exec($ch);
$debug['curl_errno'] = curl_errno($ch);
$debug['curl_error'] = curl_error($ch);
$debug['http_code'] = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
$debug['curl_info'] = curl_getinfo($ch);
$debug['response_head'] = is_string($result) ? mb_substr($result, 0, 2000) : $result;
curl_close($ch);
if ($debug['curl_errno'] !== 0) {
$debug['error_stage'] = 'curl_exec';
return $debug;
}
if ($debug['http_code'] < 200 || $debug['http_code'] >= 300) {
$debug['error_stage'] = 'http_non_2xx';
return $debug;
}
$debug['ok'] = true;
$debug['error_stage'] = null;
return $debug;
}
}