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.

Maintainers

Package info

github.com/jeffersongoncalves/laravel-favicon

pkg:composer/jeffersongoncalves/laravel-favicon

Transparency log

Fund package maintenance!

jeffersongoncalves

Statistics

Installs: 66

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

1.0.0 2026-08-27 14:17 UTC

This package is auto-updated.

Last update: 2026-08-27 14:22:32 UTC


README

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.