ultiwebtechnologies/laravel-version-toast-notification 问题修复 & 功能扩展

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

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

ultiwebtechnologies/laravel-version-toast-notification

Composer 安装命令:

composer require ultiwebtechnologies/laravel-version-toast-notification

包简介

A Laravel package to display a Bootstrap toast when a new version is available.

README 文档

README

A lightweight, zero-dependency Laravel package that automatically notifies your users in the browser whenever you deploy a new release—no extra release manager or email blasts required.

Releasing new versions and making sure your users know about them can quickly become a blocker—especially for startups without a formal release process or dedicated release manager. Emails are slow, error-prone, and add overhead to every deploy.

This package streamlines the entire flow:

  1. CI/CD writes a version file
    On every commit (or tag), your GitHub Actions (or any CI) grab the latest Git tag and short commit SHA, then write a simple public/build.version.json:

    {
      "tag": "v1.2.3",
      "commit": "g5f3e2c1"
    }
    
  2. Laravel exposes the version At runtime, the package reads that JSON and makes tag and commit available in your Blade views.

  3. Browser toast on change A tiny JavaScript snippet compares the current version (embedded in your page) against the file in public/. If there’s a mismatch, it pops a Bootstrap toast prompting the user to refresh.

Features

  • 🔄 Automatic version bump via CI on every push or tag
  • ⚡ Zero-config Blade integration—just include a single partial
  • 🍞 Bootstrap-powered toast (configurable position, styling)
  • 📦 Composer-ready—one composer require and an install command

Installation

  1. Require the package via Composer:
composer require ultiwebtechnologies/laravel-version-toast-notification
  1. Publish the assets and scaffold your layout:
php artisan version-toast:install
  1. In your main layout (e.g. resources/views/layouts/app.blade.php), just before add:
@include('vendor.version-toast.toast')```
<script src="/vendor/version-toast/js/version-toast.js"></script>

GitHub Actions Snippet

Add this to your CI workflow (e.g. .github/workflows/deploy-dev.yml) to generate and commit public/build.version.json:

jobs:
  deploy-dev:
    runs-on: ubuntu-latest

    steps:
      # 1️⃣ Checkout with tags (shallow history + tags only)
      - name: Checkout repo
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          persist-credentials: true

      # 2️⃣ Determine version & commit
      - name: Gather version info
        id: vars
        run: |
          if git describe --tags --abbrev=0 >/dev/null 2>&1; then
            TAG=$(git describe --tags --abbrev=0)
          else
            TAG="0.0.0"
          fi
          COMMIT=$(git rev-parse --short HEAD)
          echo "tag=$TAG"      >> $GITHUB_OUTPUT
          echo "commit=$COMMIT" >> $GITHUB_OUTPUT

      # 3️⃣ Write build.version.json
      - name: Write version file to public/
        run: |
          mkdir -p public
          cat > public/build.version.json <<EOF
          {
            "tag": "${{ steps.vars.outputs.tag }}",
            "commit": "g${{ steps.vars.outputs.commit }}"
          }
          EOF

      # 4️⃣ Commit & push only if changed
      - name: Commit version file
        run: |
          git config user.name  "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git add public/build.version.json
          if git diff --cached --quiet; then
            echo "No version changes; skipping commit."
          else
            git commit -m "ci: bump build.version to ${{ steps.vars.outputs.tag }}.g${{ steps.vars.outputs.commit }}"
            git push origin env/dev
          fi

Configuration

You can publish and tweak the default config:

php artisan vendor:publish --tag=version-toast
  • version_file: filename in public/ (default: build.version.json)

  • poll_interval: how often (in seconds) the browser checks for updates (default: 300)

License

MIT © ULTIweb Technologies

ultiwebtechnologies/laravel-version-toast-notification 适用场景与选型建议

ultiwebtechnologies/laravel-version-toast-notification 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 06 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ultiwebtechnologies/laravel-version-toast-notification 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ultiwebtechnologies/laravel-version-toast-notification 我们能提供哪些服务?
定制开发 / 二次开发

基于 ultiwebtechnologies/laravel-version-toast-notification 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-13