magarrent / laravel-favicon-generator
Generate and render favicons from Images
Fund package maintenance!
magarrent
Requires
- php: ^8.1
- illuminate/contracts: ^9.0
- intervention/image: ^2.7
- spatie/laravel-package-tools: ^1.13.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-03-29 00:54:00 UTC
README
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.