humans / avatars
Installs: 1 232
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- illuminate/http: ^10.0|^11.0
Requires (Dev)
- laravel/pint: ^1.14.0
- orchestra/testbench: ^9.0
- pestphp/pest: ^2.34.2
- phpunit/phpunit: ^10.5.12
README
This package allows downloads from multiple providers and it returns the first successful result.
Setup
composer require humans/avatars
Usage
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('jaggy@humans.ph'), new Providers\Unavatar('jaggy'), new Providers\Unavatar('jaggy@hey.com'), new Providers\UiAvatars('Jaggy Gauran'), ); $response->contents; $response->extension;
Testing
Avatars provides two testing fakes to make testing a lot easier.
Force a success with specific contents
Avatars::pass('example image content', 'gif');
Force the avatar to fail
Avatars::fail();