定制 jeffersongoncalves/laravel-favicon-proxy 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jeffersongoncalves/laravel-favicon-proxy

Composer 安装命令:

composer require jeffersongoncalves/laravel-favicon-proxy

包简介

A Laravel package that proxies and server-side caches website favicons (Google S2 by default) behind a same-origin route, so visitors' browsers never hit the third-party favicon service. Validates the upstream content-type, sends nosniff, negative-caches failures and falls back to a transparent pixe

README 文档

README

Laravel Favicon Proxy

Laravel Favicon Proxy

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

Proxy website favicons through your own host. Instead of pointing an external-link <img> straight at a third-party favicon service (a cross-origin connection on every page, leaking which links a visitor sees), this fetches the icon server-side once, caches the bytes, and serves them same-origin — the browser never talks to the upstream.

  • Default upstream is Google's S2 favicon service; configurable.
  • Validates the upstream content-type and sends X-Content-Type-Options: nosniff (a non-image response is never served under an image type).
  • Negative-caches failures, falls back to a transparent 1×1 pixel.

Installation

composer require jeffersongoncalves/laravel-favicon-proxy

The /favicon-proxy route is registered automatically. Point your icons at it:

<img src="{{ route('favicon-proxy', ['domain' => 'laravel.com']) }}" alt="" width="16" height="16">

Optionally publish the config:

php artisan vendor:publish --tag="favicon-proxy-config"

Configuration

Key Default Description
enabled true Register the proxy route.
path favicon-proxy Route path.
middleware ['throttle:120,1'] Middleware on the route.
endpoint https://www.google.com/s2/favicons Upstream favicon service.
query domain Query parameter carrying the domain.
size 64 Requested icon size (px).
timeout 6 Upstream request timeout (s).
cache_prefix favicon Cache key prefix.
cache_days 30 How long a fetched icon is cached.
negative_cache_hours 6 How long a failure is negative-cached.

Testing

composer test

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固