Download the PHP package sowrensen/svg-avatar-generator without Composer

On this page you can find all versions of the php package sowrensen/svg-avatar-generator. 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 svg-avatar-generator

Offline SVG Avatar Generator for Laravel

Latest Version on Packagist GitHub Tests Action Status Total Downloads

If you find this package useful, please consider to โญ it. That would be lit!

Generating SVG avatars on the fly is nothing new. There are tons of free/paid services and packages available to do that. So, why another package for same task?

Well, this one has some subtle but nifty advantages over available packages, here's a few of them:

Requirements

Laravel PHP SVGAvatarGenerator
11.x >=8.2 2.x
9.x-10.x >=8.1 1.x

Installation

Install the package via composer:

For older versions:

[!CAUTION] Breaking change: Named color support, e.g. red, green in foreground and gradient_colors is dropped since version 2.0. If you're using such names in config or in code, you should change them to hexadecimal code or keep using version 1.x releases.

Optionally, you can publish the config file with:

[!IMPORTANT] You should republish the config file after updating.

Usage

As model accessor

The usage of this package is stupidly simple. Use the svg-avatar.php config file to set your preferred decoration. Then use the Facade to generate an avatar on the fly. The recommended way to achieve that is defining an accessor in your model:

[!TIP] If your accessor is different from the original attribute, you might want to put it in $appends array so that it loads automatically with your model.

Override default config

If you want you can generate an avatar totally different from your configured style. It has all helpful methods to make that possible:

Customize initials

You can define the second initial using studly case. For example,

Provided string Produced initial
John Doe JD
JohnDoe JD
Johndoe JO
JohndoE JE

Customize Extractor

The default initial extractor class produces results shown above. However, if you want something different, you can create your own Extractor class. To do so create a new class that implements Sowren\SvgAvatarGenerator\Extractors\Extractor interface. An ideal place to put this class would be under App\Extractors namespace in your app directory.

After doing that, set the class as default extractor in config.

Sample Output

Testing

Run following command to execute test cases:

Changelog

Please see respective CHANGELOG-x.x file for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.


All versions of svg-avatar-generator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/laravel-package-tools Version ^1.13.0
illuminate/contracts Version ^11.0
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 sowrensen/svg-avatar-generator contains the following files

Loading the files please wait ....