Download the PHP package creativeorange/gravatar without Composer
On this page you can find all versions of the php package creativeorange/gravatar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download creativeorange/gravatar
More information about creativeorange/gravatar
Files in creativeorange/gravatar
Package gravatar
Short Description A Laravel Gravatar package for retrieving gravatar image URLs or checking the existance of an image.
License MIT
Informations about the package gravatar
Gravatar for Laravel 5 - 10
Installation
First, pull in the package through Composer via the command line:
or add the following to your composer.json file and run composer update
.
Then include the service provider within (Laravel 5.3 or below) app/config/app.php
.
If using Laravel 5.4, include service provider withing config/app.php
If you want to use the facade, add this to de bottom of app/config/app.php
And, for convenience, add a facade alias to this same file at the bottom:
If you are using Laravel 5.4 or greater, add as follows, add to config/app.php
Finally, publish the config by running the php artisan vendor:publish
command
Usage
Within your controllers or views, you can use
this will return the URL to the gravatar image of the specified email address.
In case of a non-existing gravatar, it will return return a URL to a placeholder image.
You can set the type of the placeholder in the configuration option fallback
.
For more information, visit gravatar.com
Alternatively, you can check for the existence of a gravatar image by using
This will return a boolean (true
or false
).
Or you can pass a url to a custom image using the fallback method:
Configuration
You can create different configuration groups to use within your application and pass the group name as a second parameter to the get
-method:
There is a default group in config/gravatar.php
which will be used when you do not specify a second parameter.
If you would like to add more groups, feel free to edit the config/gravatar.php
file. For example:
then you can use the following syntax:
Alternatively, you could also pass an array directly as the second parameter as inline options. So, instead of passing a configuration key, you pass an array, which will be merged with the default group: