Download the PHP package elijahcruz/avatar without Composer

On this page you can find all versions of the php package elijahcruz/avatar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package avatar

PHP Avatars

Generate avatars quickly and easily through one simple to use class.

PHP Avatars was created with one VERY simple goal in mind, to be able to generate a URL for avatars, without memorizing the options that Avatar generators and providers such as Gravatar and UI Avatars provide.

COMING SOON: I will be adding built-in integration to Laravel, which will allow you to use a Facade to generate the URLs.

Requirements

There are ZERO requirements, other than needing PHP, needing Componser, and the website you're wanting to add PHP Avatars to. That's it.

Install

Installing is as simple as requiring it in Composer.

`

Usage

Using PHP Avatars is made to be very simple, however even though it's very simple, it has the ability to enable you to do everthing that each provider normally should allow you to do. For example, set the default in Gravatar, or set the background and color in UI Avatars.

Basic Example:

`

This is all is takes to load the users Gravatar. However, you can also have options as well. And there are multiple ways to do this:

`

As you may have noticed, when initializing PHP Avatar, the 2nd parameter is which generator you are using. You can also specify which type using it's method:

`

This allows you to switch between avatar generators quickly and easily. But what if each one uses different options, or you wanted to generate the URL again, but with a different size, no problem. Any options that aren't defined in the generator your currently using are ignored. Any that are, can be overwritten.

When using these, you can also add the new identifier with this.

`

`

You can also reset all options to a blank slate using the resetOptions() method. If you add an array to this, it will reset the array then add those options to it.

`

But what if you wanted to also change from using an email, to the person's name, so UI Avatars shows an actual name? No problem. Just use the newIdentifier() method;

`

The best part about all of this? They can be chained!

`

This is what makes PHP Avatars super simple, but VERY powerful.

This is all is takes to easily manage your avatars for your users.

Laravel Usage

The package now thankfully has Laravel support. You can now use a Facade that includes two amazing methods.

`

With the facade, you can still chain the existing methods that the framework agnostic version contains.

`

This makes is very easy to use inside of Laravel.

If you use UI Avatar more than gravatar, or want to change some other setting, you can always publish the config file:

`

Currently Supported Proviers

Meanwhile there are so many options in terms of providers out there, we're working on making as many as possible work with PHP Avatars, to give you the best possible package for this. Each provider's own options that they provide are included in PHP Avatars, to make things VERY simple.

Gravatar

Identifier Type: email

Options:

Option Type Accepts
default string mp, 404, identicon, monsterid, wavatar, retro, robohash, blank
force_default bool true, false
rating string g, pg, r, x
size int Any integer
extension string .jpg

UI Avatar

Identifier Type: Name

Options:

Option Type Accepts Default
size int 16-512 64
font_size int 0.1-1 0.5
length int Any int 2
rounded bool true, false false
bold bool true, false false
background string any hex f0e9e9
color string any hex 8b5d5d
uppercase bool true, false true
format string svg, png Depends on Accepts Header, if SVG is in header, is SVG, else PNG

All versions of avatar with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package elijahcruz/avatar contains the following files

Loading the files please wait ....