hracik / php-create-avatar-from-text
Create avatar from text. Pseudo-random background, pseudo-random initials.
Requires
- hracik/php-color-converter: 0.0.*
- symfony/options-resolver: ^4.3
Requires (Dev)
README
Create custom avatar from text
Getting Started
These instructions will get you a copy of the project up and running
Installing
Install with Composer
composer require hracik/php-create-avatar-from-text
Usage
If you want to display text (text-display is true by default), but you do not provide both text-color, background-color, then you should specify option color-scheme otherwise text and background will have same color, so text will be invisible.
Options:
- size - default 100
- background-color
- color-scheme - possible values light, dark
- text-display - default true
- text-length - default 2
- text-case - possible values upper, lower, upper-first, lower-first
- text-modification - possible values initials, pseudo
- text-color
- font-size
- font-weight
use Hracik\CreateAvatarFromText; $options = [ 'size' => 64, 'text-case' => 'upper', 'text-modification' => 'initials', 'font-weight' => 'bold', 'color-scheme' => 'light', ]; $svg = CreateAvatarFromText::($string, $options);
Examples
See examples.
Running the tests
Run
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests
For Windows platforms
./vendor/bin/phpunit.bat --bootstrap vendor/autoload.php tests
Built With
- PHPUnit - The PHP Testing Framework
- Symfony The OptionsResolver Component
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Andrej Lahucky - Initial work - Hracik
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Acknowledgments
- PurpleBooth