You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
payment/app/Helper/Platform/Notification.php

27 lines
644 B
PHP

<?php
declare(strict_types=1);
namespace App\Helper\Platform;
use GuzzleHttp\Client;
use Hyperf\Guzzle\CoroutineHandler;
use GuzzleHttp\HandlerStack;
class Notification
{
public static function post($url, $params) {
$client = new Client([
'handler' => HandlerStack::create(new CoroutineHandler()),
'timeout' => 5,
'swoole' => [
'timeout' => 10,
'socket_buffer_size' => 1024 * 1024 * 2,
],
]);
$response = $client->request('POST', $url, [
'json' => $params
]);
return (string)$response->getBody();
}
}