Skip to content

bakame-php/multiavatar-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multiavatar

Multiavatar is a multicultural avatar generator.

In total, it is possible to generate 12,230,590,464 unique avatars.

Initially coded in JavaScript, this version of Multiavatar is re-created in PHP. It can be used in PHP-based backend environments.

For more details about the Multiavatar Generator, please refer to the readme available in the JS repository.

Installation

If you don't use composer, just include Multiavatar.php in your application.

require_once('Multiavatar.php');

Via Composer:

composer require multiavatar/multiavatar-php

Usage

$avatarId = "Binx Bond";
$multiavatar = new Multiavatar($avatarId, null, null);
echo($multiavatar->svgCode);

For advanced usage, pass boolean true as the second parameter if you wish to generate an avatar without the environment part.

Pass an associative array as the third parameter to generate a specific avatar version.

$avatarId = "ANY_STRING";
$multiavatar = new Multiavatar($avatarId, true, array("part" => 11, "theme" => "C"));
echo($multiavatar->svgCode);

See index.php for examples.

API

This PHP script is powering the Multiavatar API. Simply pass the avatar's ID as the URL parameter, and the API will return the avatar's SVG code.

https://api.multiavatar.com/v1/Starcrasher

Below is a JavaScript API call example:

let avatarId = 'Binx Bond'
fetch('https://api.multiavatar.com/v1/'
+JSON.stringify(avatarId))
  .then(res => res.text())
  .then(svg => console.log(svg))

License

You can use Multiavatar for free, as long as the conditions described in the LICENSE are followed.

Screenshots

More info

For additional information and extended functionality, visit the multiavatar.com web-app.

The app is based on static html for the home page, and on Laravel 8 + Vue.js for extended functionality, including the web store.

The product mockup generator for the Merch Maker is based on the ImageMagick PHP library.

About

Multiavatar Generator in PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%