Test script:
<?php
require __DIR__ . '/../vendor/autoload.php';
$client = new Packagist\Api\Client();
$package = $client->get('i-do/not-exist');
var_export($package);
In v1.7.2 running this throws a Guzzle exception:
PHP Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `GET https://packagist.org/packages/i-do/not-exist.json` resulted in a `404 Not Found` response:
{"status":"error","message":"Package not found"}
In 2.x-dev it throws an InvalidArgumentException:
PHP Fatal error: Uncaught InvalidArgumentException: Invalid input data. in .../src/Packagist/Api/Result/Factory.php:56
We can throw a specific exception when we encounter this, which devs can use to detect a 404 on packages.