Download the PHP package drago-ex/gravatar without Composer
On this page you can find all versions of the php package drago-ex/gravatar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download drago-ex/gravatar
More information about drago-ex/gravatar
Files in drago-ex/gravatar
Package gravatar
Short Description Simple and customizable Gravatar integration for PHP applications, allowing easy Gravatar image generation based on user email with options for size, default image, and rating.
License MIT
Informations about the package gravatar
Drago Gravatar
Gravatar image URLs from email addresses for Nette, with a configurable size, default image and rating.
Requirements
- PHP >= 8.3, < 9
- Nette Framework
- Composer
Installation
Extension Registration
After installation, register the extension in your Nette configuration (neon file):
Configuration
You can adjust the size, defaultImage, and rating parameters based on your needs.
Usage in Services and Templates
Inject Drago\Gravatar\Gravatar and call getUrl(). It does not change the state of the shared
service, so it is safe for lists of several users:
Using Gravatar in Presenters
The GravatarAdapter trait passes the URL to the template as $gravatar when the presenter sets an email:
When no email is set, the variable is not passed and rendering continues normally. With a typed template class, declare the property:
In Template
Options
size: image size in pixels, 1 to 2048. Default is80.setSize()changes it only for the service, not the configuration.defaultImage: image used when the user has no Gravatar, for examplemm,identicon,monsterid,wavatar, or a URL of your own image. Default ismm. Values are URL-encoded.rating: maximum rating, one ofg,pg,r,x. Default isg. Other values throwInvalidArgumentException.
The email is trimmed, lowercased and hashed with SHA-256, as Gravatar documents.
Invalid emails throw Drago\Gravatar\EmailException, invalid sizes Drago\Gravatar\SizeException.
getGravatar() throws EmailException when setEmail() has not been called.
All versions of gravatar with dependencies
nette/di Version ^3.2.1
nette/schema Version ^1.2
nette/utils Version ^4.0
nette/application Version ^3.2