jeffersongoncalves / laravel-favicon
This Laravel package serves a favicon.ico route, a browserconfig.xml for Windows tiles, and Apple/PNG touch icon head links from config-driven, Vite-resolved icon assets.
Package info
github.com/jeffersongoncalves/laravel-favicon
pkg:composer/jeffersongoncalves/laravel-favicon
Fund package maintenance!
Requires
- php: ^8.2
- illuminate/routing: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.30
- orchestra/testbench: ^9.0|^10.0|^11.0
- pestphp/pest: ^3.7.4|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
This package is auto-updated.
Last update: 2026-08-27 14:22:32 UTC
README
Laravel Favicon
This Laravel package serves a favicon.ico route, a browserconfig.xml for Windows tiles, and Apple/PNG touch icon <head> links from config-driven, Vite-resolved icon assets. It's the favicon/icon layer used standalone or underneath laravel-pwa-favicon, which adds the PWA manifest.json on top.
Installation
You can install the package via composer:
composer require jeffersongoncalves/laravel-favicon
You can publish the config file with:
php artisan vendor:publish --tag="favicon-config"
This is the contents of the published config file:
return [ 'enabled' => true, 'favicon' => 'resources/favicon/favicon.ico', 'browserconfig_url' => '/browserconfig.xml', 'tile_color' => '#ffffff', ];
Heads up — the
/favicon.icoroute. Whenenabledistrueandfaviconis set, the package registers a PHPGET /favicon.icoroute. If you also ship a staticpublic/favicon.ico, the web server serves the static file first and the PHP route is never reached — so the static file always wins. To force the package to serve the favicon, remove the staticpublic/favicon.ico. To disable the PHP route entirely, setfavicontonull.
Usage
Once installed, the package registers the following routes at the application root (when favicon.enabled is true):
GET /browserconfig.xml— Windows tile configuration (application/xml)GET /favicon.ico— the favicon (registered only whenfavicon.faviconis set)
The favicon::head Blade view
Renders every icon-related <head> tag — PNG icon links, Apple touch icons,
msapplication-* tile metas, and the msapplication-config meta — in one
place:
<head> {{-- ... --}} @include('favicon::head') </head>
browserConfigUrl is the only param, defaulting to config('favicon.browserconfig_url'):
@include('favicon::head', ['browserConfigUrl' => '/browserconfig.xml'])
Icon assets
Icon URLs are resolved through Vite (Vite::asset(...)), so the PNGs must live in your application under resources/favicon/ and be part of your Vite build. The package expects these files:
resources/favicon/
android-icon-192x192.png
favicon-32x32.png
favicon-96x96.png
favicon-16x16.png
apple-icon-57x57.png ... apple-icon-180x180.png
ms-icon-70x70.png
ms-icon-144x144.png
ms-icon-150x150.png
ms-icon-310x310.png
favicon.ico
Apple touch icons
iOS Safari ignores the manifest icons array, so add the Apple touch icon <link> tags to your <head>:
use JeffersonGoncalves\Favicon\Favicon; @foreach (Favicon::appleHeadLinks() as $link) <link rel="{{ $link['rel'] }}" sizes="{{ $link['sizes'] }}" href="{{ $link['href'] }}"> @endforeach
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.