PHPackages                             ultiwebtechnologies/laravel-version-toast-notification - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ultiwebtechnologies/laravel-version-toast-notification

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ultiwebtechnologies/laravel-version-toast-notification
======================================================

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

v1.0.0(11mo ago)12MITPHPPHP &gt;=8.0

Since Jun 13Pushed 11mo agoCompare

[ Source](https://github.com/ultiwebtechnologies/laravel-version-toast-notification)[ Packagist](https://packagist.org/packages/ultiwebtechnologies/laravel-version-toast-notification)[ RSS](/packages/ultiwebtechnologies-laravel-version-toast-notification/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Introduction
============

[](#introduction)

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
========

[](#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
============

[](#installation)

1. Require the package via Composer:

```
composer require ultiwebtechnologies/laravel-version-toast-notification

```

2. Publish the assets and scaffold your layout:

```
php artisan version-toast:install

```

3. In your main layout (e.g. resources/views/layouts/app.blade.php), just before add:

```
@include('vendor.version-toast.toast')```

```

GitHub Actions Snippet
======================

[](#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
