mrgoodbytes8667 / avatar-bundle
A Symfony bundle for avatar caching
Installs: 1 807
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
Type:symfony-bundle
Requires
- php: ^8.1
- ext-gd: *
- ext-imagick: *
- ext-json: *
- doctrine/orm: ^2.8
- liip/imagine-bundle: ^2.4
- mrgoodbytes8667/enum-serializer-bundle: ^3.0 | ^4.0
- mrgoodbytes8667/response-bundle: ^3.2 | ^4.0 | ^5.0 | ^6.0
- multiavatar/multiavatar-php: dev-feature/improve-implementation#8ca1c620bab28e81cf994eadbaeccd8e2ef14c49
- sensio/framework-extra-bundle: ^5.1 | ^6.0
- symfony/polyfill-uuid: ^1.20
- symfony/validator: ^5.3 | ^6.0
Requires (Dev)
- doctrine/common: ^3.0
- mrgoodbytes8667/test-common: >=0.0.27
- mrgoodbytes8667/test-common-faker: ^0.3.4
- symfony/maker-bundle: ^1.0
- symfony/messenger: ^5.3 | ^6.0
- symfony/test-pack: ^1.0.8
- symfony/var-dumper: ^5.3 | ^6.0
Suggests
- symfony/messenger: For using messages to reset avatar caches
Conflicts
- doctrine/annotations: <1.11.1
- doctrine/cache: <1.10.2
- doctrine/collections: <1.6.7
- doctrine/event-manager: <1.1.1
- doctrine/inflector: <1.4.3
- doctrine/lexer: <1.2.1
- doctrine/persistence: <2.1.0
- phpunit/phpunit: <9.5
- symfony/framework-bundle: <5.3.0
- symfony/property-access: <5.3.0
- symfony/property-info: <5.3.0
- symfony/serializer: <5.2.2
- dev-main
- 0.11.x-dev
- 0.10.x-dev
- v0.10.2
- v0.10.1
- v0.10.0
- 0.9.x-dev
- v0.9.0
- v0.9.0-BETA1
- 0.8.x-dev
- v0.8.0
- 0.7.x-dev
- v0.7.1
- v0.7.0
- v0.7.0-RC1
- v0.7.0-BETA6
- v0.7.0-BETA5
- v0.7.0-BETA4
- v0.7.0-BETA3
- v0.7.0-BETA2
- v0.7.0-BETA1
- 0.6.x-dev
- v0.6.0
- v0.6.0-BETA1
- 0.5.x-dev
- v0.5.0
- v0.5.0-RC1
- 0.4.x-dev
- v0.4.2
- v0.4.1
- v0.4.0
- 0.3.x-dev
- v0.3.1
- v0.3.0
- v0.2.1
- v0.2.0
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- v0.0.2
- v0.0.1
This package is auto-updated.
Last update: 2024-10-30 01:53:52 UTC
README
A Symfony bundle for avatar caching
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
All applications
Add the Multiavatar repo to your composer.json file.
"repositories": [ { "type": "vcs", "url": "https://github.com/bakame-php/multiavatar-php.git" } ]
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
$ composer require mrgoodbytes8667/avatar-bundle
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require mrgoodbytes8667/avatar-bundle
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php
file of your project:
// config/bundles.php return [ // ... Bytes\AvatarBundle\BytesAvatarBundle::class => ['all' => true], ];
All applications
Create a routing file named config\routes\bytes_avatar.yaml
with the content below, changing the prefix
value to whatever you want the routes changed to.
_bytes_avatar: resource: '@BytesAvatarBundle/Resources/config/routing.php' prefix: /avatar
Create a config file named config\packages\bytes_avatar.yaml
with the content below.
bytes_avatar: multiavatar: ~
Sample implementation for a User entity that already has a required email field:
<?php 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); }
License
avatar-bundle by MrGoodBytes is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
Based on a work at https://github.com/mrgoodbytes8667/avatar-bundle.