PHPackages                             dwr/avatar-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. dwr/avatar-bundle

ActiveSymfony-bundle[Image &amp; Media](/categories/media)

dwr/avatar-bundle
=================

Simply Symfony 3.x &amp; Symfony 2.x bundle which creates avatars images using GD.

2.0(9y ago)69.2k1MITPHPPHP ^5.6 || ^7.2

Since Oct 24Pushed 9y ago1 watchersCompare

[ Source](https://github.com/dariuszwrzesien/DwrAvatarBundle)[ Packagist](https://packagist.org/packages/dwr/avatar-bundle)[ Docs](https://github.com/dariuszwrzesien/DwrAvatarBundle.git)[ RSS](/packages/dwr-avatar-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (6)Used By (0)

[![SensioLabsInsight](https://camo.githubusercontent.com/daed8892125a7ac4474d8b3d08dff5bfb5c6ecee3b05f99cfcf8f684fc9f390b/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f31326235373037302d356133372d346264622d613862332d6165646466646464636666662f6269672e706e67)](https://insight.sensiolabs.com/projects/12b57070-5a37-4bdb-a8b3-aeddfdddcfff)
==================================================================================================================================================================================================================================================================================================================================================================================

[](#)

[![License](https://camo.githubusercontent.com/2c935d86bcc23e0fcd99a7859b7f4c3f925632b7e2b1211bb80619ac42ee8bf0/68747470733a2f2f706f7365722e707567782e6f72672f6477722f6176617461722d62756e646c652f6c6963656e7365)](https://packagist.org/packages/dwr/avatar-bundle)[![Latest Stable Version](https://camo.githubusercontent.com/9bfc206db49bc604cb960ed895c2496cab7c17ef2e984be60adf6ebfeaf3d0b9/68747470733a2f2f706f7365722e707567782e6f72672f6477722f6176617461722d62756e646c652f762f737461626c65)](https://packagist.org/packages/dwr/avatar-bundle)[![Total Downloads](https://camo.githubusercontent.com/dfe58ac0843da9742d52d35fe59fee65615936c432d41ac10a367774c09bedab/68747470733a2f2f706f7365722e707567782e6f72672f6477722f6176617461722d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/dwr/avatar-bundle)[![Build Status](https://camo.githubusercontent.com/b44ab48861e31760cc9220b0584568a37a76afa5cb7ea705a15edc963e3ec6c8/68747470733a2f2f7472617669732d63692e6f72672f6461726975737a77727a657369656e2f44777241766174617242756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dariuszwrzesien/DwrAvatarBundle)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/72aaa4264c1c5d4f51977dfdeb684a8f47fb34c5cd057428079264930f970770/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6461726975737a77727a657369656e2f44777241766174617242756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dariuszwrzesien/DwrAvatarBundle/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/9b74c8af3b2e8e5cb30ec24f6d8d03ae1029b648a4c4c00670cf162951d53043/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6461726975737a77727a657369656e2f44777241766174617242756e646c652f62616467652e706e67)](https://coveralls.io/r/dariuszwrzesien/DwrAvatarBundle)

DwrAvatarBundle
===============

[](#dwravatarbundle)

This bundle provides easy image avatar generator support for Symfony2 and Symfony3.

Example of avatars:

plainAvatars:

[![plainAvatar example #1](Resources/doc/plain1.jpg)](Resources/doc/plain1.jpg) [![plainAvatar example #2](Resources/doc/plain2.jpg)](Resources/doc/plain2.jpg) [![plainAvatar example #3](Resources/doc/plain3.jpg)](Resources/doc/plain3.jpg)

profileAvatars:

[![profileAvatar example #1](Resources/doc/profile1.jpg)](Resources/doc/profile1.jpg) [![profileAvatar example #2](Resources/doc/profile2.jpg)](Resources/doc/profile2.jpg) [![profileAvatar example #3](Resources/doc/profile3.jpg)](Resources/doc/profile3.jpg)

In order to generate Avatar you can:

**In Controller**

```
public function indexAction()
    {

        $avatar = new AvatarFactory();

        //for plainAvatar
        $plainAvatar = $avatar->generate(new PlainAvatar(140, 140));

        //for profileAvatar
        $profileAvatar = $avatar->generate(new ProfileAvatar(140, 140));

        return array(
            'plainAvatar'   => $plainAvatar->render()
            'profileAvatar' => $profileAvatar->render()
        );
    }
```

And in a **view** file (twig):

```

```

**Installation**
----------------

[](#installation)

Installation is a quick 3 steps process:

1. Download DwrAvatarBundle using composer
2. Enable the Bundle
3. Add routing to routing.yml in order to can open example in your browser

### Step 1: Download DwrAvatarBundle using composer

[](#step-1-download-dwravatarbundle-using-composer)

Add DwrAvatarBundle in version 2.0 (**for Symfony 3**) in your composer.json:

```
{
    "require": {
        "dwr/avatar-bundle": "2.0"
    }
}
```

Add DwrAvatarBundle in version 1.0 (**for Symfony 2**) your composer.json:

```
{
    "require": {
        "dwr/avatar-bundle": "1.0"
    }
}
```

Download the bundle by running the command:

```
$ php composer.phar require dwr/avatar-bundle
```

Composer will install the bundle into your project's `vendor/dwr/avatar-bundle` directory.

### Step 2: Enable the bundle

[](#step-2-enable-the-bundle)

Enable the bundle in the kernel:

```
