PHPackages                             highvertical/offline-detection - 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. highvertical/offline-detection

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

highvertical/offline-detection
==============================

Laravel Internet Offline Detection Automatically detects when a user goes offline and comes back online.

v1.0.0(1y ago)05MITJavaScriptPHP ^7.2.5|^8.0

Since Sep 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/highvertical/offline-detection)[ Packagist](https://packagist.org/packages/highvertical/offline-detection)[ RSS](/packages/highvertical-offline-detection/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Offline Detection Package
=================================

[](#laravel-offline-detection-package)

This package provides real-time internet connection monitoring for Laravel applications, with features like offline detection, reconnection handling, and syncing offline data when the internet is restored.

Features
--------

[](#features)

- **Real-time Connection Monitoring**: Automatically detects when a user goes offline and comes back online.
- **Reconnection Handling**: Shows user-friendly banners notifying users about the connection status.
- **Offline Data Synchronization**: Automatically syncs data (e.g., form submissions or other actions) stored while the user was offline, once the connection is restored.
- **Customizable UI**: Display customizable notifications for connection status changes (online/offline).
- **Configurable Timeout**: Set a custom timeout to check connection status using the config file.

Installation
------------

[](#installation)

1. Install the package via Composer (if you’re planning to publish this package, otherwise just copy the files into your Laravel project).

    ```
    composer require highvertical/offline-detection
    ```
2. Publish the package assets (views, config, and JS files):

    ```
    php artisan vendor:publish --provider="OfflineDetection\Providers\OfflineDetectionServiceProvider" --tag="config"
    php artisan vendor:publish --provider="OfflineDetection\Providers\OfflineDetectionServiceProvider" --tag="views"
    php artisan vendor:publish --provider="OfflineDetection\Providers\OfflineDetectionServiceProvider" --tag="assets"
    ```
3. Optionally, you can configure the package in `.env`:

    ```
    OFFLINE_DETECTION_ENABLED=true
    OFFLINE_DETECTION_TIMEOUT=5000
    ```

Usage
-----

[](#usage)

1. Add the following route to your `routes/web.php` file to display the offline page:

    ```
    Route::get('/offline', function () {
        return view('offlinedetection::offline');
    })->name('offline');
    ```
2. Add the following script to your main layout file (usually `resources/views/layouts/app.blade.php` or similar) to enable the offline detection feature:

    ```

    ```
3. When users go offline, they will be redirected to `/offline`, and when they come back online, the page will automatically reload or display a banner indicating the restored connection.

Configuration
-------------

[](#configuration)

The configuration file `config/offline-detection.php` allows you to set options like:

- `enabled`: Enable or disable offline detection globally.
- `timeout`: Set the time interval (in milliseconds) for checking the connection status.

Customization
-------------

[](#customization)

- **Views**: To customize the offline view, modify the published view in `resources/views/vendor/offlinedetection/offline.blade.php`.
- **JS Assets**: The JavaScript file responsible for the offline detection is located at `public/vendor/offlinedetection/offline-detection.js`. You can modify it according to your needs.

Offline Data Synchronization
----------------------------

[](#offline-data-synchronization)

To store and sync user actions when offline, use `localStorage`. For example, if you want to store form data when the user is offline:

```
function saveOfflineData(actionData) {
    let offlineData = JSON.parse(localStorage.getItem('offlineData')) || [];
    offlineData.push(actionData);
    localStorage.setItem('offlineData', JSON.stringify(offlineData));
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

610d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1754d294003e043de18e0182fbefcb33c2fb59f9550ca58dc793714d013e5a6?d=identicon)[highvertical](/maintainers/highvertical)

---

Top Contributors

[![highvertical](https://avatars.githubusercontent.com/u/111159992?v=4)](https://github.com/highvertical "highvertical (6 commits)")

### Embed Badge

![Health badge](/badges/highvertical-offline-detection/health.svg)

```
[![Health](https://phpackages.com/badges/highvertical-offline-detection/health.svg)](https://phpackages.com/packages/highvertical-offline-detection)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

20917.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9346.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
