PHPackages                             jesse-richard/dice-bear-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. jesse-richard/dice-bear-php

ActiveLibrary[Image &amp; Media](/categories/media)

jesse-richard/dice-bear-php
===========================

Simple package to generate avatars for your users

v1.0.10(1y ago)3444MITPHP

Since Dec 21Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/RichardJesse/diceBearPhp)[ Packagist](https://packagist.org/packages/jesse-richard/dice-bear-php)[ RSS](/packages/jesse-richard-dice-bear-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (12)Used By (0)

[![Dice Bear Image](Images/certificate%20of%20(1).png)](Images/certificate%20of%20(1).png)

[![Packagist Downloads](https://camo.githubusercontent.com/11b2ad02a250095a69074abf82cbd54df21a05a81d702163cfda3a5489073719/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a657373652d726963686172642f646963652d626561722d7068702e737667)](https://camo.githubusercontent.com/11b2ad02a250095a69074abf82cbd54df21a05a81d702163cfda3a5489073719/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a657373652d726963686172642f646963652d626561722d7068702e737667)[![PHP Version](https://camo.githubusercontent.com/b7e5edcc63e16eaaedcbf846e464a6210af427db3752332cdd253fe106241d3a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344372e322d627269676874677265656e2e737667)](https://camo.githubusercontent.com/b7e5edcc63e16eaaedcbf846e464a6210af427db3752332cdd253fe106241d3a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344372e322d627269676874677265656e2e737667)[![Current Version](https://camo.githubusercontent.com/566be1a6bf00b55d4b60506920d6e692ee4559c4d9cc126aab8822b500de985c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a657373652d726963686172642f646963652d626561722d7068702e737667)](https://packagist.org/packages/your-vendor-name/your-package-name)

Dice Bear for Php
=================

[](#dice-bear-for-php)

This is a simple package that is aimed at making getting avatars from [Dice Bear](https://www.dicebear.com/) easy in your php application.No official affiliation with the original dice bear

Installation
------------

[](#installation)

To install the package all you need to do is run this command in your terminal.(assuming that you have composer installed)

```
 composer require jesse-richard/dice-bear-php
```

How to use
----------

[](#how-to-use)

Using diceBearPhp is pretty easy all you need to do is make use of the `NeedsAvatar` Trait and you'll be good to go.

```
use JesseRichard\DiceBearPhp\Trait\NeedsAvatar;

class User {
    use NeedsAvatar;
}
```

Utilities
---------

[](#utilities)

This package provides some utilities to make the experience with the dice Bear easy.

### Styles

[](#styles)

Dice Bear offers a couple of styles that you can take advantage of and the package supports all the available styles. This package provides for three ways to make use of the Dice Bear Styles. You can have a look at all the styles [here](https://www.dicebear.com/styles/)

```
// say the NeedsAvatar Trait is in use in the user class

$user = new User();

// You may choose to get a random style using the randomStyle() method like so
$user->randomStyle()

//You may choose to pass the style directly by name
$user->style('thumbs')

// You may choose to use the style as a method and optionally pass in the format you want it to be in using camelCase eg(big ears Neutral)
$user->bigEarsNeutral('svg')

// or
$user->bigEarsNeutral()
```

### Format

[](#format)

The avatars that are provided by the Dice Bear Api are in different file formats. The package provides a method to allow you to get the file in the format that you find most convinient. [Supported format](https://www.dicebear.com/how-to-use/http-api/#file-format)

```
// getting the avatar in jpeg format
$user->format('jpeg')

// The alternative way of passing the format is while using the stlyle as a method as had been shown
$user->bigEarsNeutral('svg')
```

### Seed

[](#seed)

This is the property that determines the initial value and that way you are able to create the same avatar again and again.And its simple to use.

```
// You may pass in your unique value that you would like to be used could be anything but you must pass it as a string
$user->seed('name')->randomStyle();
```

### Flip

[](#flip)

This property determines whether the image that is produced is fliped or not.

```
// you may not pass a parameter the default value is true
$user->flip()
 //  OR
// You may choose to pass a parameter
$user->flip(false)
```

### Rotate

[](#rotate)

This property allows you to choose how much you would like to rotate the image around a 360 degree angle.

```
// Rotates the image that is produced by 60 degrees
$user->rotate(60)
```

### Scale

[](#scale)

This property determines how zoomed in or scaled the image that is produced will be.The range being between 0 to 200

```
// Scales the image by factor of 100
$user->scale(100);
```

### Radius

[](#radius)

This property determines how rounded the image that is produced will be. The range is between 0 to 50.

```
// sets the radius of the image that will be produced with a radius of 40
$user->radius(40);
```

### Translate

[](#translate)

This property allows you to determined the position of the subject of the image that will be produced. It ranges between -100 to 100

```
// Translates the image that is produced by a factor of -50 on the x axis
$user->translate('X', -50);

// Translates the image that is produced by a factor of -50 on the y axis
$user->translate('Y', -50);
```

### Background

[](#background)

This feature allows you to make changes to the background of the image that is produced. For the background you could change the color, type and rotation.

```
// Changing background color
$user->backgroundColor('red')

// changing the background type
$user->backgroundType('solid')

// changing the angle rotation of the background
$user->backgroundRotation(70)
```

### Style specific options

[](#style-specific-options)

DiceBear offers additional options that are sometimes style specific.To take advantage of this we make use of the `options` method.

```
// Say you want to make use of the Micah style and you want to customize the eyes option to be set to round
$user->style('micah')->options(['eyes' => 'round']);
```

Avatar alternatives
-------------------

[](#avatar-alternatives)

The avatars that are provided by Dice Bear are essentially image files. The package gives you the autonomy to choose what to do with them.

```
// You may choose to get the image content and maybe do something with it
$user->getContent()

// You may choose to save the image locally and extract the path of the image
$user->saveImage('path/to/avatars_folders')->savedPath()

// You may only be intrested in the Url of the image
$user->url()
```

Contributions
-------------

[](#contributions)

Contributions are highly welcomed. Feel free to fork the repo, play around to make it better.In case of any issues feel free to open an issue and i'll be right to it.A star wouldn't hurt.😉

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance49

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Recently: every ~22 days

Total

11

Last Release

416d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a2a3b09c57191d1689f7355cc3afc42ad6db445b0a8bf7317526e07412e19ed?d=identicon)[RichardJesse](/maintainers/RichardJesse)

---

Top Contributors

[![RichardJesse](https://avatars.githubusercontent.com/u/135692621?v=4)](https://github.com/RichardJesse "RichardJesse (37 commits)")

---

Tags

avatar-placeholderdicebearphp

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/jesse-richard-dice-bear-php/health.svg)

```
[![Health](https://phpackages.com/badges/jesse-richard-dice-bear-php/health.svg)](https://phpackages.com/packages/jesse-richard-dice-bear-php)
```

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
