quick api test command

This commit is contained in:
Nabeel Shahzad
2017-12-30 11:56:38 -06:00
parent 4a1d7c59fb
commit 2bfaa9e584
3 changed files with 30 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Console\Commands;
use GuzzleHttp\Client;
use App\Console\BaseCommand;
class TestApi extends BaseCommand
{
protected $signature = 'phpvms:test-api {apikey} {url}';
protected $httpClient;
/**
* Run dev related commands
*/
public function handle()
{
$this->httpClient = new Client([
'headers' => [
'Authorization' => $this->argument('apikey'),
]
]);
$result = $this->httpClient->get($this->argument('url'));
print_r(\GuzzleHttp\json_decode($result->getBody()));
}
}