1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 00:20:08 +01:00

Replace HTTPFul with Guzzle

This commit is contained in:
Bram Ceulemans
2021-12-20 16:49:06 +01:00
parent e96523ba9f
commit 4c98f63b96
3 changed files with 10 additions and 7 deletions

View File

@@ -3,7 +3,8 @@
namespace Valet;
use DomainException;
use Httpful\Request;
use GuzzleHttp\Client;
use GuzzleHttp\Utils;
class Ngrok
{
@@ -24,7 +25,7 @@ public function currentTunnelUrl($domain = null)
foreach ($this->tunnelsEndpoints as $endpoint) {
$response = retry(20, function () use ($endpoint, $domain) {
$body = Request::get($endpoint)->send()->body;
$body = Utils::jsonDecode((new Client())->get($endpoint)->getBody());
if (isset($body->tunnels) && count($body->tunnels) > 0) {
return $this->findHttpTunnelUrl($body->tunnels, $domain);

View File

@@ -2,7 +2,8 @@
namespace Valet;
use Httpful\Request;
use GuzzleHttp\Client;
use GuzzleHttp\Utils;
class Valet
{
@@ -72,11 +73,12 @@ public function extensions()
* @param string $currentVersion
* @return bool
*
* @throws \Httpful\Exception\ConnectionErrorException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function onLatestVersion($currentVersion)
{
$response = Request::get('https://api.github.com/repos/laravel/valet/releases/latest')->send();
$url = 'https://api.github.com/repos/laravel/valet/releases/latest';
$response = Utils::jsonDecode((new Client())->get($url)->getBody());
return version_compare($currentVersion, trim($response->body->tag_name, 'v'), '>=');
}