Git Product home page Git Product logo

laravel-ui-avatars's Introduction

Laravel ui avatar generator based on https://ui-avatars.com

StyleCI Shield build:passed Total Downloads Latest Stable Version License

Installation

This package requires Laravel 5.4 or higher.

  1. You can install the package via composer:
composer require darbaoui/laravel-ui-avatars

Usage

use Darbaoui\Avatar\Facades\Avatar;

// simple avatar
Avatar::name('imad darbaoui')
        ->background('ffd1bf')
        ->color('ff4500')->get();
// avatar = https://ui-avatars.com/api/?name=imad+darbaoui&background=ffd1bf&color=ff4500


// you can chain any other method if you want to add other parameters to your avatar
Avatar::name('imad darbaoui')
        ->size(124)
        ->rounded()
        ->uppercase(false)
        ->svg()
        ->background('ffd1bf')
        ->color('ff4500')->get();
// avatar = https://ui-avatars.com/api/?size=124&rounded=1&uppercase=0&format=svg&name=imad+darbaoui&background=ffd1bf&color=ff4500

Available methods

methods description default value
name() The name used to generate initials John Doe
size() Avatar image size in pixels. Between: 16 and 512 64
rounded() Boolean specifying if the returned image should be a circle false
uppercase() Decide if the API should uppercase the name/initials. true
fontSize() Font size in percentage of size. Between 0.1 and 1. 0.5
background() Hex color for the image background, without the hash (#) f0e9e9
color() Hex color for the font, without the hash (#). 8b5d5d
length() Length of the generated initials. 2
bold() Boolean specifying if the returned letters should use a bold font. Default: false false
svg() Decide to the avatar should be return SVG -

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.