Skip to content

Instantly share code, notes, and snippets.

@winni4eva
Created January 3, 2019 18:38
Show Gist options
  • Save winni4eva/49c5898c060b102949f457bf3959b3bb to your computer and use it in GitHub Desktop.
Save winni4eva/49c5898c060b102949f457bf3959b3bb to your computer and use it in GitHub Desktop.
Get user information
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class FetchUsersInfo extends Command
{
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$client = new \GuzzleHttp\Client();
$pages = collect([1,2,3,4,5]);
$pages->map(function($page) use($client) {
$res = $client->request('GET', "https://reqres.in/api/users?page=$page");
logger($res->getBody());
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment