Download the PHP package renfordt/larvatar without Composer
On this page you can find all versions of the php package renfordt/larvatar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package larvatar
Larvatar
Larvatar is a package that combines different avatar styles, like Gravatar, Initials Avatar.
Installation
The recommended way of installing Larvatar is to use Composer. Run the following command to install it to you project:
Upgrading to 2.0
Version 2.0 brings many breaking changes. Check the Upgrade Guide to avoid any issues.
Basic Usage
Include the LarvatarTrait with use Renfordt\Larvatar\Traits\LarvatarTrait;
in your user class and add the following method:
Adjust the method as you please, only requirement is that the methods name is getAvatar()
.
Advanced Usage
The general usage is simple. Create a new Larvatar class, insert name and email and the avatar type you wish.
Alternatively you can create an instance of the Name
class, which provides you more possibilities.
There are currently nine different types of avatars available:
InitialsAvatar
Forms
The InitialsAvatar gives you the possibility to choose between three different forms. A circle, which is the default, a
hexagon and a square. Choose it by using the setForm()
method. The input is either a string or a value of the
Enum FormTypes
.
If you are using the hexagon form, you have additionally the possibility to rotate the form:
Colors
Usually the colors will be automatically selected by the provided name.
If you for some case want to manually set the contrast of the colors, you can use the methods setBackgroundLightness()
and setTextLightness()
. The parameter is a float with a value range 0
to 1
where 0
means a darker color and 1
is a lighter color.
Additionally, you can change the offset which will generate a different color.
Font Weight
You can also change the font weight with the method setFontWeight()
.
Identicons (Larvatar Style)
All versions of larvatar with dependencies
ext-gd Version *
meyfa/php-svg Version ^0.14.0
renfordt/clamp Version ^v1.0.1
renfordt/colors Version ^v1.0.3