This package allows downloads from multiple providers and it returns the first successful result.
composer require humans/avatars
This will return the first successful photo.
use Humans\Avatars\Facades\Avatars;
use Humans\Avatars\Attempt;
use Humans\Avatars\Providers;
$response = Avatars::attempt(
new Providers\Unavatar('[email protected]'),
new Providers\Unavatar('jaggy'),
new Providers\Unavatar('[email protected]'),
new Providers\UiAvatars('Jaggy Gauran'),
);
$response->contents;
$response->extension;
Avatars provides two testing fakes to make testing a lot easier.
Avatars::pass('example image content', 'gif');
Avatars::fail();