alto / favicon
Generate a modern favicon set (SVG icon, apple-touch-icon, favicon.ico, Web Manifest) from a single SVG or PNG file.
Package info
pkg:composer/alto/favicon
Fund package maintenance!
Requires
- php: >=8.3
- psr/log: ^3.0
- symfony/console: ^7.3 || ^8.0
- symfony/filesystem: ^7.3 || ^8.0
- symfony/process: ^7.3 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.92
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.5
Suggests
- ext-gd: Required for PNG resizing if Imagick is not available
- ext-imagick: Recommended for better quality PNG resizing
README
Generate a focused, modern favicon set from one SVG or PNG source.
ALTO Favicon produces the small set of files current browsers and devices need, plus the exact HTML tags required to use them. The CLI and PHP API share the same options, preserve SVG input for modern browsers, and select an available rasterizer automatically.
vendor/bin/favicon assets/logo.svg --output public/favicons
The default result includes icon.svg, favicon.ico,
apple-touch-icon.png, and favicon.html. Optional flags add a Web App
Manifest, Android icons, a maskable icon, and a Google Search PNG.
Installation
Install ALTO Favicon with Composer:
composer require alto/favicon
ALTO Favicon requires PHP 8.3 or later. SVG input needs rsvg-convert,
Inkscape, ImageMagick CLI, or the Imagick extension. PNG input needs Imagick or
GD. Composer installs the PHP package dependencies automatically.
Quick Start
Generate the default set from an SVG:
vendor/bin/favicon assets/logo.svg --output public/favicons
Then copy the generated contents of public/favicons/favicon.html into the
document <head>.
Add a manifest and a dedicated Google Search icon when needed:
vendor/bin/favicon assets/logo.svg \
--output public/favicons \
--public-path /favicons \
--app-name "My App" \
--manifest \
--search-png
Documentation
| Guide | Contents |
|---|---|
| Documentation index | Browse the complete guide set |
| Getting started | Generate and install the first favicon set |
| CLI | Commands, flags, and examples |
| PHP API | Programmatic generation and reports |
| Configuration | Options, defaults, and overwrite behavior |
| Rasterizers | SVG and PNG adapter selection |
| Generated files | Default and optional outputs |
| Errors | Input and rasterization failures |
Contributing
Contributions of all kinds are welcome. Visit the project on GitHub to report a bug, suggest a feature, or open a pull request.
Before submitting code, run:
# Runs PHP CS Fixer, PHPStan, and PHPUnit
composer qa
Support
ALTO Favicon is open source. You can support its continued development through GitHub Sponsors.
Sharing this package with others or starring it on GitHub is also much appreciated.
License
ALTO Favicon is released by ALTO PHP under the MIT License.