I am testing API and still face this problem when I execute the following code
$client = new Client([ \'base_uri\' => \'http://localhost\' ]);