Avatary
Simple avatar generator
Explore the docs »
View Demo · Report Bug · Request Feature
Table of Contents
About The Project
It's just a simple project to generate avatars using names. For the moment it supports only english and arabic names.
Built With
This project is made with the awesome frameworks/packages
And this awesome Readme is made possible with :
Getting Started
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
Prerequisites
Since Avatary is built using Laravel 8, so the prerequisites are the same as the framework
- PHP >= 8.0
- BCMath PHP Extension
- Ctype PHP Extension
- Fileinfo PHP Extension
- JSON PHP Extension
- Mbstring PHP Extension
- OpenSSL PHP Extension
- PDO PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension
- GD PHP Extension
Installation
-
Clone the repo
git clone https://github.com/prettifystudio/avatary.git
-
Install Composer packages
composer install
-
Copy the environment file & edit it accordingly
cp .env.example .env
-
Generate application key
php artisan key:generate
-
Linking Storage folder to public
php artisan storage:link
-
Serve the application
php artisan serve
Usage
Using the API is simple, all you have to do is hit the Initials API. Without any parameter, the endpoint will generate an image with random background color.
But you can customize it as you need.
Name
If you want to customize the name, you can hit the endpoint with the query param name
.
The default value is "John Doe"
GET https://avatary.prettify.studio/api/initials?name=Koussay Fridhi
Background Color
Background colors, are generated randomly, but you can speacify it as follows:
The Background color must be in hexadecimal form, otherwise the system will throw an exception
GET https://avatary.prettify.studio/api/initials?bgcolor=f43f43
Size
The default size of the generated image is 260px, but you can specify a custom size
GET https://avatary.prettify.studio/api/initials?size=75
This will generate a 75*75 px image. Generally you may want to use a smaller size so the request is handled quickly.
Text Color
You may want also to specify the text color, inside the image.
The default value is
#fafafa
The text color must be in hexadecimal form, otherwise the system will throw an exception
GET https://avatary.prettify.studio/api/initials?color=fafafa
Shape
The API will generate 2 shapes, a circle or a square. The default one is the circle, but you can get a square shape
GET https://avatary.prettify.studio/api/initials?shape=square
Full request
GET https://avatary.prettify.studio/api/initials?name=Koussay%20Fridhi&bgcolor=f44336&shape=circle&color=fafafa&size=250
This request will generate the following image
You can use any param you want, for example you want only the name and the size,
GET https://avatary.prettify.studio/api/initials?name=Koussay%20Fridhi&size=125
Testing
This application is using PestPHP for testing. In order to run the test suite
./vendor/bin/pest
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Your Name - @PrettifyStudio - [email protected]
Project Link: https://github.com/prettifystudio/avatary