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 yesterday

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 35% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

656d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/111159992?v=4)[highvertical](/maintainers/highvertical)[@highvertical](https://github.com/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

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M281](/packages/illuminate-pipeline)[illuminate/redis

The Illuminate Redis package.

8314.6M375](/packages/illuminate-redis)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

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