PHPackages                             laravelwudel/laravelwudel-notif - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. laravelwudel/laravelwudel-notif

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

laravelwudel/laravelwudel-notif
===============================

A comprehensive Laravel package for web push notifications with VAPID support - 100% Custom Implementation, No External Dependencies

v1.0.6(8mo ago)010MITPHPPHP ^8.2CI failing

Since Aug 20Pushed 8mo agoCompare

[ Source](https://github.com/idpcks/laravelwudel_notif)[ Packagist](https://packagist.org/packages/laravelwudel/laravelwudel-notif)[ Docs](https://github.com/idpcks/laravelwudel_notif)[ RSS](/packages/laravelwudel-laravelwudel-notif/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Push Notification Package
=================================

[](#laravel-push-notification-package)

Package Laravel yang komprehensif untuk web push notifications dengan dukungan VAPID.

**Version:** 1.0.3 | **Release Date:** 20 Agust 2025

**📖 Documentation:** [UNINSTALL.md](UNINSTALL.md) | [VERSIONING.md](VERSIONING.md)

Fitur
-----

[](#fitur)

- ✅ Dukungan Laravel 11 &amp; 12
- ✅ Web Push Notifications dengan VAPID (Custom Implementation)
- ✅ **100% Custom Code** - Tidak bergantung pada library eksternal
- ✅ Service Provider auto-discovery
- ✅ Facade untuk kemudahan penggunaan
- ✅ Model dan Migration yang fleksibel
- ✅ Queue support untuk notifikasi massal
- ✅ Error handling yang robust
- ✅ Logging yang detail
- ✅ Testing support
- ✅ **Branding Sendiri** - LaravelWudel Notif

Instalasi
---------

[](#instalasi)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require laravelwudel/laravelwudel-notif
```

### 2. Publish Configuration dan Migration

[](#2-publish-configuration-dan-migration)

```
php artisan vendor:publish --provider="LaravelWudel\LaravelWudelNotif\LaravelWudelNotifServiceProvider"
```

### 3. Jalankan Migration

[](#3-jalankan-migration)

```
php artisan migrate
```

### 4. Generate VAPID Keys

[](#4-generate-vapid-keys)

```
php artisan push:generate-vapid-keys
```

Konfigurasi
-----------

[](#konfigurasi)

### Environment Variables

[](#environment-variables)

**⚠️ IMPORTANT: VAPID keys are required for this package to function.**

Tambahkan ke file `.env`:

```
WEBPUSH_VAPID_SUBJECT=mailto:your-email@example.com
WEBPUSH_VAPID_PUBLIC_KEY=your_public_key_here
WEBPUSH_VAPID_PRIVATE_KEY=your_private_key_here
```

**Note:**

- `WEBPUSH_VAPID_SUBJECT` harus dalam format `mailto:email@domain.com`
- `WEBPUSH_VAPID_PUBLIC_KEY` harus 87 karakter (base64)
- `WEBPUSH_VAPID_PRIVATE_KEY` harus 43 karakter (base64)
- Jika keys tidak dikonfigurasi, package akan error dan memberikan pesan yang jelas

### Config File

[](#config-file)

File `config/laravelwudel-notif.php` akan otomatis dibuat dengan konfigurasi default.

Penggunaan
----------

[](#penggunaan)

### Basic Usage

[](#basic-usage)

```
use LaravelWudel\LaravelWudelNotif\Facades\PushNotification;

// Kirim notifikasi ke user tertentu
PushNotification::sendToUser($user, 'Judul', 'Pesan notifikasi');

// Kirim notifikasi ke semua user
PushNotification::sendToAll('Judul', 'Pesan broadcast');

// Kirim dengan data tambahan
PushNotification::sendToUser($user, 'Judul', 'Pesan', [
    'url' => '/dashboard',
    'action' => 'view'
]);
```

### Via Service

[](#via-service)

```
use LaravelWudel\LaravelWudelNotif\Services\WebPushService;

class NotificationController extends Controller
{
    public function __construct(private WebPushService $pushService) {}

    public function sendNotification(Request $request)
    {
        $user = auth()->user();
        $sent = $this->pushService->sendToUser(
            $user,
            $request->title,
            $request->message
        );

        return response()->json(['sent' => $sent]);
    }
}
```

### Model Relationships

[](#model-relationships)

```
// User model
public function pushSubscriptions()
{
    return $this->hasMany(PushSubscription::class);
}

// PushSubscription model
public function user()
{
    return $this->belongsTo(User::class);
}
```

Frontend Integration
--------------------

[](#frontend-integration)

### JavaScript

[](#javascript)

```
// Subscribe to push notifications
async function subscribeToPushNotifications() {
    try {
        const registration = await navigator.serviceWorker.register('/sw.js');
        const subscription = await registration.pushManager.subscribe({
            userVisibleOnly: true,
            applicationServerKey: 'YOUR_VAPID_PUBLIC_KEY'
        });

        // Send subscription to backend
        await fetch('/api/push-subscriptions', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content
            },
            body: JSON.stringify(subscription)
        });
    } catch (error) {
        console.error('Error subscribing to push notifications:', error);
    }
}
```

### Service Worker

[](#service-worker)

```
// sw.js
self.addEventListener('push', function(event) {
    const data = event.data.json();

    event.waitUntil(
        self.registration.showNotification(data.title, {
            body: data.message,
            icon: data.icon,
            badge: data.badge,
            data: data.data
        })
    );
});
```

Commands
--------

[](#commands)

### Generate VAPID Keys

[](#generate-vapid-keys)

```
php artisan push:generate-vapid-keys
```

### Cleanup Old Subscriptions

[](#cleanup-old-subscriptions)

```
php artisan push:cleanup-subscriptions
```

Testing
-------

[](#testing)

```
composer test
```

Uninstall Instructions
----------------------

[](#uninstall-instructions)

**📖 For detailed uninstall guide, see [UNINSTALL.md](UNINSTALL.md)**

### Automatic Uninstall (Recommended)

[](#automatic-uninstall-recommended)

Package ini menyediakan uninstall otomatis yang akan membersihkan semua file dan cache secara otomatis:

```
# Uninstall via Composer (akan menjalankan cleanup otomatis)
composer remove laravelwudel/laravelwudel-notif

# Atau jalankan command uninstall manual
php artisan laravelwudel-notif:uninstall
```

### Manual Uninstall (Jika Automatic Gagal)

[](#manual-uninstall-jika-automatic-gagal)

Jika uninstall otomatis gagal, ikuti langkah manual berikut:

#### 1. Hapus Package dari Composer

[](#1-hapus-package-dari-composer)

```
composer remove laravelwudel/laravelwudel-notif
```

#### 2. Hapus File Konfigurasi

[](#2-hapus-file-konfigurasi)

```
rm config/laravelwudel-notif.php
```

#### 3. Hapus Migration (Jika Sudah Dijalankan)

[](#3-hapus-migration-jika-sudah-dijalankan)

```
# Rollback migration terlebih dahulu
php artisan migrate:rollback --step=1

# Hapus file migration
rm database/migrations/*_create_push_subscriptions_table.php
```

#### 4. Hapus Model (Jika Sudah Di-publish)

[](#4-hapus-model-jika-sudah-di-publish)

```
rm app/Models/PushSubscription.php
```

#### 5. Hapus Views dan Assets (Jika Sudah Di-publish)

[](#5-hapus-views-dan-assets-jika-sudah-di-publish)

```
rm -rf resources/views/vendor/laravelwudel-notif
rm -rf public/vendor/laravelwudel-notif
```

#### 6. Bersihkan Cache Laravel

[](#6-bersihkan-cache-laravel)

```
# Clear semua cache
php artisan optimize:clear

# Atau hapus cache secara manual jika command gagal
rm -rf bootstrap/cache/*
```

#### 7. Rebuild Autoload

[](#7-rebuild-autoload)

```
composer dump-autoload
```

### Troubleshooting Uninstall Issues

[](#troubleshooting-uninstall-issues)

#### Error: Service Provider Tidak Ditemukan

[](#error-service-provider-tidak-ditemukan)

Jika mengalami error "Service Provider Tidak Ditemukan" setelah uninstall:

```
# Hapus semua cache Laravel
rm -rf bootstrap/cache/*

# Clear compiled classes
php artisan clear-compiled

# Rebuild autoload
composer dump-autoload

# Clear semua cache
php artisan optimize:clear
```

#### Error: Cache Corruption

[](#error-cache-corruption)

Jika cache Laravel menjadi corrupt:

```
# Hapus semua cache
rm -rf bootstrap/cache/*

# Install ulang dependencies
composer install

# Clear dan rebuild cache
php artisan optimize:clear
```

#### Emergency Cleanup Script

[](#emergency-cleanup-script)

Jika semua cara di atas gagal, gunakan script emergency cleanup:

```
# Jalankan emergency cleanup
php artisan laravelwudel-notif:uninstall --force

# Atau hapus semua cache secara manual
rm -rf bootstrap/cache/*
composer install
php artisan optimize:clear
```

### Post-Uninstall Checklist

[](#post-uninstall-checklist)

Setelah uninstall, pastikan:

- Package sudah dihapus dari `composer.json`
- File konfigurasi sudah dihapus
- Migration sudah di-rollback dan dihapus
- Model sudah dihapus
- Views dan assets sudah dihapus
- Cache Laravel sudah dibersihkan
- Autoload sudah di-rebuild
- Aplikasi Laravel bisa dijalankan normal

### Support untuk Uninstall Issues

[](#support-untuk-uninstall-issues)

Jika mengalami masalah saat uninstall:

1. **Buat Issue** di [GitHub Repository](https://github.com/idpcks/laravelwudel_notif)
2. **Jelaskan Error** yang terjadi dengan detail
3. **Lampirkan Log** error jika ada
4. **Sebutkan Versi** Laravel dan PHP yang digunakan

Contributing
------------

[](#contributing)

1. Fork repository
2. Create feature branch from `main`
3. Commit changes
4. Push to feature branch
5. Create Pull Request to `main` branch

**Important:** All releases and tags must be created from the `main` branch to ensure Packagist gets the stable version.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Repository &amp; Links
----------------------

[](#repository--links)

- **GitHub Repository**: [https://github.com/idpcks/laravelwudel\_notif](https://github.com/idpcks/laravelwudel_notif)
- **Packagist Package**:

Installation via Composer
-------------------------

[](#installation-via-composer)

Package ini sudah tersedia di Packagist dan dapat diinstall dengan mudah:

```
composer require laravelwudel/laravelwudel-notif
```

🚀 Custom Implementation
-----------------------

[](#-custom-implementation)

Package ini menggunakan **100% custom implementation** Semua fitur web push notification diimplementasikan dari awal menggunakan:

- **Custom VAPID Key Generation** - Generate keys menggunakan OpenSSL
- **Custom Web Push Service** - Implementasi lengkap web push protocol
- **Custom JWT Signing** - ECDSA signing untuk VAPID authentication
- **Custom HTTP Client** - Menggunakan Guzzle untuk HTTP requests
- **Custom Error Handling** - Error handling yang robust dan customizable

### Keuntungan Custom Implementation:

[](#keuntungan-custom-implementation)

✅ **Branding Sendiri** - Tidak ada dependency eksternal
✅ **Full Control** - Kontrol penuh atas semua fitur
✅ **Performance** - Optimized untuk kebutuhan spesifik
✅ **Security** - Implementasi security yang dapat diaudit
✅ **Maintenance** - Tidak bergantung pada update library lain
✅ **Customization** - Mudah disesuaikan dengan kebutuhan

Support
-------

[](#support)

Untuk dukungan, silakan buat issue di [repository GitHub](https://github.com/idpcks/laravelwudel_notif) atau hubungi tim LaravelWudel.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance58

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

265d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/594ea7208ca8715c6b462a563a7387a7853dec8882f9f7d5bb35717e5318e1e2?d=identicon)[idpcks](/maintainers/idpcks)

---

Top Contributors

[![idpcks](https://avatars.githubusercontent.com/u/136402646?v=4)](https://github.com/idpcks "idpcks (25 commits)")

---

Tags

laravelno-dependenciespush notificationsservice workerWeb Pushvapidweb notificationslaravelwudel-notifcustom-implementation

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/laravelwudel-laravelwudel-notif/health.svg)

```
[![Health](https://phpackages.com/badges/laravelwudel-laravelwudel-notif/health.svg)](https://phpackages.com/packages/laravelwudel-laravelwudel-notif)
```

###  Alternatives

[bentools/webpush-bundle

Send push notifications through Web Push Protocol to your Symfony users.

71274.3k](/packages/bentools-webpush-bundle)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[vemcogroup/laravel-sparkpost-driver

SparkPost driver to use with Laravel 6.x|7.x|8.x|9.x|10.x

421.7M1](/packages/vemcogroup-laravel-sparkpost-driver)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)

PHPackages © 2026

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