DiceBear engine
Name: dicebear. Output: SVG fetched from the DiceBear HTTP API
(https://api.dicebear.com/9.x/{style}/svg).
Avatar::engine('dicebear')
->seed('user@example.com')
->size(256)
->style('bottts')
->backgroundColor('#FF6B6B')
->radius(10)
->generate();
Options
| Option | Method | Type | Default |
|---|---|---|---|
| Style | style() | string | avataaars |
| Background color | backgroundColor() | string|array | — |
| Corner radius | radius() | int | — |
The seed and size are sent as the seed and size query parameters.
Style validation
The style is interpolated into the request URL path, so it is restricted to
[a-z0-9-]. An invalid style makes the engine return null (decline) rather
than issue a request, triggering the fallback chain. Use any style supported by
DiceBear, for example avataaars, bottts, or identicon.
Background color
Accepts a single hex string or an array of hex strings. Leading # is stripped
and values are joined with commas for the backgroundColor parameter.
Radius
An integer (>= 0) passed through as the radius parameter.
Network behavior
The SVG is fetched through AbstractEngine::fetchUrl(): a 5-second timeout, at
most one redirect, and a 5 MiB response cap. A failed request returns null, so
pair this engine with a local fallback.