Files
phpvms/app/Console/Commands/TestApi.php
Nabeel S 12848091a2 Laravel 9 Update (#1413)
Update to Laravel 9 and PHP 8+

Co-authored-by: B.Fatih KOZ <fatih.koz@gmail.com>
2022-03-14 11:45:18 -04:00

34 lines
720 B
PHP

<?php
namespace App\Console\Commands;
use App\Contracts\Command;
use GuzzleHttp\Client;
class TestApi extends Command
{
protected $signature = 'phpvms:test-api {apikey} {url}';
/**
* @var Client
*/
protected Client $httpClient;
/**
* Run dev related commands
*/
public function handle()
{
$this->httpClient = new Client([
'headers' => [
'Authorization' => $this->argument('apikey'),
'Content-type' => 'application/json',
'X-API-Key' => $this->argument('apikey'),
],
]);
$result = $this->httpClient->get($this->argument('url'));
echo $result->getBody();
}
}