PHPackages                             usenoty/noty-laravel - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. usenoty/noty-laravel

ActiveLibrary[Queues &amp; Workers](/categories/queues)

usenoty/noty-laravel
====================

Non-blocking Noty Notification Channel for Laravel.

v1.1.0(5mo ago)04MITPHPPHP ^8.2|^8.3|^8.4CI passing

Since Nov 28Pushed 5mo agoCompare

[ Source](https://github.com/usenoty/noty-laravel)[ Packagist](https://packagist.org/packages/usenoty/noty-laravel)[ Docs](https://github.com/usenoty/noty-laravel)[ RSS](/packages/usenoty-noty-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (9)Versions (3)Used By (0)

Noty Laravel
============

[](#noty-laravel)

[![Latest Version](https://camo.githubusercontent.com/53065560eca6090ba05bb6bb3250a2de95bc1207ab4c53ab2ae3665c2730846a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7573656e6f74792f6e6f74792d6c61726176656c2e737667)](https://packagist.org/packages/usenoty/noty-laravel)[![License](https://camo.githubusercontent.com/13fe846069295ee2d25e05b035dde8b2598c57dbb5c30e0f4dc022b915a9d5df/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7573656e6f74792f6e6f74792d6c61726176656c)](https://packagist.org/packages/usenoty/noty-laravel)[![Tests](https://github.com/usenoty/noty-laravel/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/usenoty/noty-laravel/actions/workflows/tests.yml)[![PHP Version](https://camo.githubusercontent.com/cd463ce7576fbc49ef5cf4facdc3b555cb3333d224dfeb8c9dd74b38778bfa71/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e31253230253743253230382e32253230253743253230382e33253230253743253230382e342d626c75652e737667)](https://php.net)[![Laravel Version](https://camo.githubusercontent.com/b7bd8c10f88035d2b0039e09cc47b4c71a6f3d85267e3efe9a9118631e0e8dae/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302e7825323025374325323031312e782d7265642e737667)](https://laravel.com)

A **non-blocking** notification channel for Laravel that sends events to Noty API. Perfect for tracking user activities, application events, and telemetry data without impacting your app's performance.

✨ Features
----------

[](#-features)

- 🚀 **Non-Blocking**: Uses async HTTP requests that don't slow down your app
- 🛡️ **Fail-Silent**: Never breaks your app, even if the tracking service is down
- ⚡ **Auto-Flush**: Automatically sends pending events after response is sent
- 🎯 **Simple API**: Just like Sentry - use `captureEvent()` or Laravel notifications
- 💎 **Fluent Builder**: Type-safe `NotyMessage` class for elegant event building
- 🔄 **Queue Support**: Optional queue-based transport for high-volume applications
- 📊 **Rich Events**: Support for actions, tags, attachments, and emojis

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require usenoty/noty-laravel
```

Publish the configuration file:

```
php artisan vendor:publish --provider="Noty\Laravel\Providers\NotyServiceProvider"
```

⚙️ Configuration
----------------

[](#️-configuration)

Set your Noty API credentials in `.env`:

```
# API Configuration
NOTY_DSN=http://localhost:3020
NOTY_TOKEN=p7362mdlvmixjbvle01q7oeooqhfzq33

# Define your channels (named channels or channel IDs)
NOTY_DEFAULT_CHANNEL=general
NOTY_CHANNEL_GENERAL=channel_Arys9gID0J0HKv
NOTY_CHANNEL_AUTH=channel_xyz123auth
NOTY_CHANNEL_PAYMENTS=channel_abc456pay

# Transport (http or queue)
NOTY_TRANSPORT=http
NOTY_DEFAULT_PRIORITY=NORMAL
```

🚀 Quick Start
-------------

[](#-quick-start)

### Method 1: Using NotyMessage (Recommended)

[](#method-1-using-notymessage-recommended)

The `NotyMessage` class provides a fluent, type-safe API:

```
use Noty\Laravel\NotyMessage;

NotyMessage::create('Order Created')
    ->message('Order #1234 has been created')
    ->channel('orders')
    ->priority(NotyMessage::PRIORITY_HIGH)
    ->action('View Order', route('orders.show', 1234), true)
    ->tag('order_id', 1234)
    ->tag('amount', 99.99)
    ->emoji('🛒')
    ->send();
```

### Method 2: Using Laravel Notifications

[](#method-2-using-laravel-notifications)

Create a notification class:

```
namespace App\Notifications;

use Illuminate\Notifications\Notification;

class UserLoggedIn extends Notification
{
    public function __construct(private $user) {}

    public function via($notifiable)
    {
        return ['noty'];
    }

    public function toNoty($notifiable)
    {
        return [
            'title' => 'User logged in: ' . $this->user->email,
            'message' => 'User logged in from IP: ' . request()->ip(),
            'channel' => 'auth',
            'priority' => 'HIGH',
            'actions' => [
                [
                    'name' => 'View Profile',
                    'url' => route('users.show', $this->user),
                    'browser' => true
                ]
            ],
            'tags' => [
                'ip_address' => request()->ip(),
                'user_id' => $this->user->id,
            ]
        ];
    }
}
```

Send the notification:

```
$user->notify(new UserLoggedIn($user));
```

### Method 3: Using captureEvent (Like Sentry)

[](#method-3-using-captureevent-like-sentry)

```
use Noty\Laravel\Facades\Noty;

Noty::captureEvent([
    'title' => 'Payment Received',
    'message' => 'Payment of $100.00 received',
    'channel' => 'payments',
    'priority' => 'HIGH',
    'actions' => [
        [
            'name' => 'View Order',
            'url' => route('orders.show', $order->id),
            'browser' => true
        ]
    ],
    'tags' => [
        'order_id' => $order->id,
        'amount' => 100.00,
        'currency' => 'USD',
    ]
]);
```

Or using the helper function:

```
noty()->captureEvent([
    'title' => 'User Registered',
    'channel' => 'auth',
]);
```

📋 NotyMessage API Reference
---------------------------

[](#-notymessage-api-reference)

### Basic Usage

[](#basic-usage)

```
use Noty\Laravel\NotyMessage;

// Simple notification
NotyMessage::create('Order Created')
    ->channel('orders')
    ->send();

// With message and priority
NotyMessage::create('Payment Received')
    ->message('Payment of $100.00 received')
    ->channel('payments')
    ->priority(NotyMessage::PRIORITY_HIGH)
    ->send();
```

### Priority Constants

[](#priority-constants)

```
NotyMessage::PRIORITY_HIGH    // High priority
NotyMessage::PRIORITY_NORMAL  // Normal priority (default)
NotyMessage::PRIORITY_LOW     // Low priority
```

### Actions

[](#actions)

```
// Single action
NotyMessage::create('Order #123')
    ->action('View Order', route('orders.show', 123), true)
    ->send();

// Multiple actions
NotyMessage::create('Order #123')
    ->action('View Order', route('orders.show', 123), true)
    ->action('Download Invoice', route('orders.invoice', 123))
    ->send();

// Actions array
NotyMessage::create('Order #123')
    ->actions([
        ['name' => 'View Order', 'url' => route('orders.show', 123), 'browser' => true],
        ['name' => 'Download Invoice', 'url' => route('orders.invoice', 123)]
    ])
    ->send();
```

### Tags

[](#tags)

```
// Single tag
NotyMessage::create('User Login')
    ->tag('user_id', $user->id)
    ->send();

// Multiple tags
NotyMessage::create('User Login')
    ->tag('user_id', $user->id)
    ->tag('ip_address', request()->ip())
    ->tags(['browser' => 'Chrome', 'os' => 'MacOS'])
    ->send();
```

### Emojis

[](#emojis)

```
NotyMessage::create('New Event')
    ->emoji('🎉')
    ->message('A new event has been created')
    ->send();
```

🔧 Channel Configuration
-----------------------

[](#-channel-configuration)

### Named Channels (Recommended)

[](#named-channels-recommended)

Define channel names in `.env`:

```
NOTY_CHANNEL_AUTH=channel_Arys9gID0J0HKv
NOTY_CHANNEL_PAYMENTS=channel_abc123xyz
NOTY_CHANNEL_ORDERS=channel_def456uvw
```

Use in code:

```
NotyMessage::create('Event')
    ->channel('auth') // Uses channel_Arys9gID0J0HKv
    ->send();
```

### Direct Channel IDs

[](#direct-channel-ids)

```
NotyMessage::create('Event')
    ->channel('channel_Arys9gID0J0HKv')
    ->send();
```

🚀 Transport Options
-------------------

[](#-transport-options)

### HTTP Transport (Default)

[](#http-transport-default)

Events are sent asynchronously via HTTP after the response is sent to the user.

```
NOTY_TRANSPORT=http
```

### Queue Transport

[](#queue-transport)

For high-volume applications, use queue transport:

```
NOTY_TRANSPORT=queue
NOTY_QUEUE_CONNECTION=redis
NOTY_QUEUE_NAME=noty-events
NOTY_QUEUE_BATCH_SIZE=10
```

📊 Event Data Structure
----------------------

[](#-event-data-structure)

Events are sent to the Noty API with the following structure:

```
{
  "channel": "channel_Arys9gID0J0HKv",
  "title": "User logged in: user@example.com",
  "message": "User logged in from IP: 172.38.21.134",
  "priority": "HIGH",
  "actions": [
    {
      "name": "View Profile",
      "url": "https://app.example.com/users/123",
      "browser": true
    }
  ],
  "attachments": [],
  "tags": {
    "ip_address": "172.38.21.134",
    "user_email": "user@example.com"
  }
}
```

🔄 How It Works
--------------

[](#-how-it-works)

1. **Non-Blocking**: When you call `captureEvent()`, the event is queued but not sent immediately
2. **Async Requests**: HTTP requests are made asynchronously using Guzzle promises
3. **Auto-Flush**: After Laravel sends the response, pending events are flushed in the background
4. **Fail-Silent**: If the Noty API is unreachable, your app continues working normally

```
Request → Your App Logic → Response to User → Flush Events (async)
                ↓
          captureEvent() stores promise

```

📝 Complete Example
------------------

[](#-complete-example)

```
use Noty\Laravel\Facades\Noty;

// In a controller
public function login(Request $request)
{
    $user = Auth::user();

    // Using NotyMessage (recommended)
    NotyMessage::create('User Login')
        ->message($user->email . ' logged in')
        ->channel('auth')
        ->priority(NotyMessage::PRIORITY_HIGH)
        ->action('View Profile', route('users.show', $user), true)
        ->tag('ip', request()->ip())
        ->tag('user_id', $user->id)
        ->emoji('🔐')
        ->send();

    return redirect('/dashboard');
}
```

🎯 When to Use Each Method
-------------------------

[](#-when-to-use-each-method)

- **NotyMessage**: Best for most cases - type-safe, fluent, and readable
- **Laravel Notifications**: Best for reusable notifications sent to multiple users
- **captureEvent**: Best for simple, one-off events or custom builders

📋 Requirements
--------------

[](#-requirements)

- **PHP**: 8.2, 8.3, or 8.4
- **Laravel**: 10.x, 11.x, or 12.x
- **Guzzle**: 7.x

🔄 Supported Versions
--------------------

[](#-supported-versions)

LaravelPHPStatus12.x8.2+✅ Active11.x8.2+✅ Active10.x8.1+✅ Active9.x8.0+❌ Unsupported8.x7.3+❌ Unsupported🧪 Testing
---------

[](#-testing)

This package is thoroughly tested with:

- **50 tests** covering all functionality
- **100+ assertions** ensuring reliability
- **PHPStan Level 5** static analysis
- **Multiple PHP versions** (8.2, 8.3, 8.4)
- **Multiple Laravel versions** (10.x, 11.x, 12.x)

### Running Tests

[](#running-tests)

```
# Run all tests
composer test

# Run with coverage
composer test-coverage

# Run static analysis
composer phpstan
```

📄 License
---------

[](#-license)

This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.

---

Made with ❤️ for Laravel developers

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance71

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

Every ~3 days

Total

2

Last Release

162d ago

PHP version history (2 changes)v1.0.0PHP ^8.1|^8.2|^8.3|^8.4

v1.1.0PHP ^8.2|^8.3|^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a1b8c26f05da76fd7bff0540005fe0f5dab53098c066523b468542221e23270?d=identicon)[ahmetkorkmaz3](/maintainers/ahmetkorkmaz3)

---

Top Contributors

[![ahmetkorkmaz3](https://avatars.githubusercontent.com/u/29120746?v=4)](https://github.com/ahmetkorkmaz3 "ahmetkorkmaz3 (17 commits)")

---

Tags

asyncnon-blockinglaraveleventsnotificationstrackingtelemetrynotynotification-channel

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/usenoty-noty-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/usenoty-noty-laravel/health.svg)](https://phpackages.com/packages/usenoty-noty-laravel)
```

###  Alternatives

[laravel/slack-notification-channel

Slack Notification Channel for laravel.

89069.7M111](/packages/laravel-slack-notification-channel)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[laravel-notification-channels/pusher-push-notifications

Pusher native Push Notifications driver.

282733.2k1](/packages/laravel-notification-channels-pusher-push-notifications)[laravel-notification-channels/rocket-chat

Rocket.Chat Notifications channel for Laravel 5.6+

1345.5k](/packages/laravel-notification-channels-rocket-chat)

PHPackages © 2026

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