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.
2,055 2
Install
composer require jeffersongoncalves/laravel-favicon
Latest Version:1.0.0
PHP:^8.2
License:MIT
Last Updated:Sep 29, 2026
Links: GitHub  ·  Packagist
Maintainer: jeffersongoncalves

Laravel Favicon

Laravel Favicon

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.ico route. When enabled is true and favicon is set, the package registers a PHP GET /favicon.ico route. If you also ship a static public/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 static public/favicon.ico. To disable the PHP route entirely, set favicon to null.

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 when favicon.favicon is 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.

Related Packages

jeffersongoncalves/filament-refresh-sidebar

Automatically refresh the Filament sidebar navigation when certain events occur,...

3,230 11
jeffersongoncalves/filament-logo

A simple yet effective Filament plugin that automatically adds the Filament logo...

15,610 5
jeffersongoncalves/filament-cookie-consent

This Filament package provides a simple and elegant way to implement cookie cons...

16,055 8
jeffersongoncalves/filament-cep-field

The Filament CEP Field is a custom input component designed specifically for Bra...

5,025 8
beyondcode/laravel-favicon

Create dynamic favicons based on your environment settings.

52,549 376

Version History

Version Released PHP Laravel License
1.0.0 ^8.2 ^11.0|^12.0|^13.0 MIT