1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 08:30:07 +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; namespace Valet;
use DomainException; use DomainException;
use Httpful\Request; use GuzzleHttp\Client;
use GuzzleHttp\Utils;
class Ngrok class Ngrok
{ {
@@ -24,7 +25,7 @@ public function currentTunnelUrl($domain = null)
foreach ($this->tunnelsEndpoints as $endpoint) { foreach ($this->tunnelsEndpoints as $endpoint) {
$response = retry(20, function () use ($endpoint, $domain) { $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) { if (isset($body->tunnels) && count($body->tunnels) > 0) {
return $this->findHttpTunnelUrl($body->tunnels, $domain); return $this->findHttpTunnelUrl($body->tunnels, $domain);

View File

@@ -2,7 +2,8 @@
namespace Valet; namespace Valet;
use Httpful\Request; use GuzzleHttp\Client;
use GuzzleHttp\Utils;
class Valet class Valet
{ {
@@ -72,11 +73,12 @@ public function extensions()
* @param string $currentVersion * @param string $currentVersion
* @return bool * @return bool
* *
* @throws \Httpful\Exception\ConnectionErrorException * @throws \GuzzleHttp\Exception\GuzzleException
*/ */
public function onLatestVersion($currentVersion) 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'), '>='); return version_compare($currentVersion, trim($response->body->tag_name, 'v'), '>=');
} }

View File

@@ -28,8 +28,8 @@
"illuminate/container": "~5.1|^6.0|^7.0|^8.0", "illuminate/container": "~5.1|^6.0|^7.0|^8.0",
"mnapoli/silly": "^1.0", "mnapoli/silly": "^1.0",
"symfony/process": "^3.0|^4.0|^5.0", "symfony/process": "^3.0|^4.0|^5.0",
"nategood/httpful": "^0.2", "tightenco/collect": "^5.3|^6.0|^7.0|^8.0",
"tightenco/collect": "^5.3|^6.0|^7.0|^8.0" "guzzlehttp/guzzle": "^7.4"
}, },
"require-dev": { "require-dev": {
"mockery/mockery": "^1.2.3", "mockery/mockery": "^1.2.3",