mattitjaab/laravel-plausible-proxy 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

mattitjaab/laravel-plausible-proxy

最新稳定版本:v1.5

Composer 安装命令:

composer require mattitjaab/laravel-plausible-proxy

包简介

A Laravel package for proxying Plausible Analytics, improving performance and privacy.

README 文档

README

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

A Laravel package for proxying Plausible Analytics, improving performance.

Requirements

  • Laravel 12
  • PHP 8.3, 8.4

🚀 Installation

  1. Install the package via Composer:

    composer require mattitjaab/laravel-plausible-proxy
  2. Publish the configuration file:

    php artisan vendor:publish --tag=plausible-proxy-config
  3. Add the following environment variables to your .env file:

    PLAUSIBLE_DOMAIN=https://plausible.io

⚙️ Configuration

The config/plausible-proxy.php file allows you to customize the plausible domain:

return [
    'domain' => env('PLAUSIBLE_DOMAIN', 'https://plausible.io'),
];

🔥 Usage

1. Proxying the JavaScript file

This package proxies Plausible's script.js while caching it to improve performance and reduce external requests.

After installation, you can include the script like this:

<script defer data-domain="example.com" src="/js/script.js"></script>

The route /js/script.js is automatically handled and caches the script for 6 hours.

2. Sending Events to Plausible

Instead of sending events directly to plausible.io, the script is loaded from /js/script.js and proxies the request to Plausible via /api/event, helping to prevent blocking by ad blockers.

✅ Features

  • 🚀 Fast & Optimized: Caches the Plausible script to reduce external calls.
  • ✅ No issues with ad blockers: Proxies the request via a local API endpoint.
  • 🛠 Fully Configurable: Easily set your own Plausible instance via .env.

🛠 Testing

You can run tests with:

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-30