Download the PHP package runmybusiness/initialcon without Composer
On this page you can find all versions of the php package runmybusiness/initialcon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download runmybusiness/initialcon
More information about runmybusiness/initialcon
Files in runmybusiness/initialcon
Package initialcon
Short Description Create a GMail esque avatar based on the users intials & a persistant identifier such as an email address.
License MIT
Homepage http://runmybusiness.com
Informations about the package initialcon
Initial based icon generator for PHP
Installation
The recommended way to install Initialcon is through composer.
Just create a composer.json
file for your project:
And run these two commands to install it:
Now you can add the autoloader (if your framework doesn't already do this for you), and you will have access to the library:
You're done.
Usage
Images are generated in PNG format with a colored background & the initials in white text.
The string can be an email, an IP address, a username, an ID or something else that is persistant between page loads. This string determines the color of the icon background and will persist between pageloads so long as the string doesnt change.
Generate an initialcon
Create a new object.
Then you can generate and display an initialcon image
or generate and get the image data
or generate and get the base 64 image uri ready for integrate into an HTML img tag.
Change the size
By default the size will be 64 pixels. If you want to change the image size just add a secondary parameter. 512 x 512px in this example.
Color
The color is automaticaly generated according to the string hash but you can chose to specify a color by adding a third argument.
Color can be an hexadecimal with 6 characters
Image Object
You can also grab the Image object to add more manipulation to the final icon (such as rounded corders, opacity, etc). We use the Intervention library for image creation so all of its' methods are available to you.
That's it!
Unit Tests
To run unit tests, you'll need and a set of dependencies you can install using Composer:
Once installed, just launch the following command:
Everythings should be ok.
Credits
- Originally forkeed from Benjamin Laugueux's great Identicon library at (https://github.com/yzalis/Initialcon)
License
Initialcon is released under the MIT License. See the bundled LICENSE file for details.