Download the PHP package uibar/gravatar without Composer
On this page you can find all versions of the php package uibar/gravatar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package gravatar
Gravatar for Laravel 5 & 5.1
This package is a quick and simple way to implement Gravatar in your Laravel project. Enjoy!
Features
- URL generation with customized parameters
- Full img tags generation with customized parameters and HTML attributes
- Supports method chaining
- Secure connection auto-setting
Future Features
Planned features for the future:
- Possibility to use your own custom image as default (like a logo or something)
- Configuration file for defaults
- Gravatar Profiles handling
Install
-
Get the package
- Add the Service Provider and the Facade to your config/app.php file
Use
To get the Gravatar URL it's as simple as:
Of course we can also generate a full image tag. For your ease we can do this in multiple ways. Either way, the email is required to be specified.
All of these will return a default of 80x80 Gravatar.
Secure Connections
The class will set the Gravatar URL automatically based on the Request type. So you don't need to worry about what connection type to use if you have SSL enabled on your domain.
However, there is a way to force using HTTPS to retrieve the Gravatar. Use the forceSecure() method.
Customize
To be able to customize your Gravatar return you can refer to the following elements:
$email => The email of the Gravatar
$size => The size in pixels [1 - 2048]
$defaults => Default image set to use if avatar not found [404 | mm | identicon | monsterid | wavatar]
$rating => Accepted image rating [g | pg | r | x]
$image => TRUE or FALSE if you want or not to return the full image tag instead of the image URL
$attributes => The extra attributes you need for the image tag if you chose this way
$forceSecure => Forces the connection to be secure (TRUE | FALSE)
These elements can be changed either by passing them in the first parameter of the make() method as array keys (the order doesn't matter), by Method Chaining or trough the get() method params.
Here are three customized examples with the same effect that illustrates the customization methods:
It's up to you to chose the one that best fits your needs.
Method Chaining
You can use method chaining to customize your Gravatar. The same method names are used as the element names above. Let's see some examples:
Please note that in method chaining we use make() as the end of the statement not get().
License
This package is released under the MIT license and thus it's free for all to use, distribute and upgrade.
Thank you!
Thanks to these amazing people and their packages I got inspired to write my own representation of Gravatar Helper.
Thank you!