PHP code example of mrgoodbytes8667 / avatar-bundle

1. Go to this page and download the library: Download mrgoodbytes8667/avatar-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mrgoodbytes8667 / avatar-bundle example snippets


// config/bundles.php

return [
    // ...
    Bytes\AvatarBundle\BytesAvatarBundle::class => ['all' => true],
];



use Doctrine\ORM\Mapping as ORM;
use Bytes\AvatarBundle\Avatar\Gravatar;

/**
 * @var string|null
 * @ORM\Column(type="string", length=3000, nullable=true)
 */
private $avatar;

/**
 * @return string|null
 */
public function getAvatar(): ?string
{
    return $this->avatar;
}

/**
 * @param string|null $avatar
 * @return $this
 */
public function setAvatar(?string $avatar): self
{
    $this->avatar = $avatar;

    return $this;
}

/**
 * @param int $size
 * @return string
 */
public function getGravatar(int $size = 80)
{
    return Gravatar::url($this->email, $size);
}
json
"repositories": [
     {
       "type": "vcs",
       "url":  "https://github.com/bakame-php/multiavatar-php.git"
   }
]
yaml
_bytes_avatar:
  resource: '@BytesAvatarBundle/Resources/config/routing.php'
  prefix: /avatar