dicebear/core

Unique avatars from dozens of styles — deterministic, customizable, vector-based.

Maintainers

Package info

github.com/dicebear/dicebear-php

pkg:composer/dicebear/core

Statistics

Installs: 2 491

Dependents: 0

Suggesters: 0

Stars: 3

v10.2.0 2026-06-10 19:51 UTC

This package is auto-updated.

Last update: 2026-06-11 21:52:13 UTC


README

PHP implementation of the DiceBear avatar library. Generates deterministic SVG avatars from style definitions and a seed string.

DiceBear is available for multiple languages. All implementations share the same PRNG and rendering pipeline, producing identical SVG output for the same seed, style, and options, regardless of the language used.

Playground | Documentation

Installation

composer require dicebear/core

Requires PHP 8.2+ and the mbstring extension.

Usage

use DiceBear\Avatar;

// From a style definition (JSON-decoded array)
$definition = json_decode(file_get_contents('path/to/style.json'), true);

$avatar = new Avatar($definition, [
    'seed' => 'John Doe',
    'size' => 128,
]);

echo $avatar;              // SVG string
echo $avatar->toDataUri(); // data:image/svg+xml;charset=utf-8,...

Using the Style class

use DiceBear\Style;
use DiceBear\Avatar;

$style = new Style($definition);

// Create multiple avatars from the same style
$avatar1 = new Avatar($style, ['seed' => 'Alice']);
$avatar2 = new Avatar($style, ['seed' => 'Bob']);

Sponsors

Advertisement: Many thanks to our sponsors who provide us with free or discounted products.

bunny.net