magarrent/laravel-favicon-generator

Generate and render favicons from Images

1.0.0 2022-12-28 12:06 UTC

This package is auto-updated.

Last update: 2024-04-29 04:54:11 UTC


README

Latest Version on Packagist

Installation

Requires PHP Imagick

You can install the package via composer:

composer require magarrent/favicon-generator

Usage

To use your own image and convert it to the different favicons versions, use these methods. This will generate a "favicon" folder to your public_path with the different favicons formats and versions. Will also generate some XML and webmanifest according to the web standards.

Use this methods in your own scenario, when you upload the image, or just a console command, whatever. Just write your input path and optionally the public output path. If you don't specify the output (2nd param), the favicons will be saved in public/favicons

$favicon = new FaviconGenerator('path-to-your-image', 'optional-public-dist-path');
$favicon->generateFaviconsFromImagePath();

Once you generated the icons, just write these line into your <head> section of your HTML

{!! \Magarrent\FaviconGenerator\FaviconGenerator::generateHtmlMetaIcons() !!}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Roadmap

  • Tests
  • Generate icons from Image class, not from String path

Contributing

Please see CONTRIBUTING for details.

Credits

License

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