PHPackages                             64robots/batch-notifications - 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. 64robots/batch-notifications

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

64robots/batch-notifications
============================

A Laravel package that groups repetitive notifications in batches

1.0.8(1y ago)142.4k3[2 PRs](https://github.com/64robots/batch-notifications/pulls)MITPHPPHP &gt;=7.1.0|^8.0

Since Sep 5Pushed 1y ago3 watchersCompare

[ Source](https://github.com/64robots/batch-notifications)[ Packagist](https://packagist.org/packages/64robots/batch-notifications)[ RSS](/packages/64robots-batch-notifications/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (9)Dependencies (4)Versions (14)Used By (0)

Batch Notifications
===================

[](#batch-notifications)

Description
-----------

[](#description)

Batch Notifications is a Laravel package that groups repetitive notifications in batches. This package is intended for cases where notifications are dispatched repeatedly for a same Notifiable model. So, instead of sending lots of notifications (ex.: email messages) repeatedly to the Notifiable model, the notifications are grouped in batches that will be sent in periods of time.

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

[](#installation)

#### 1 - Require the package

[](#1---require-the-package)

`composer require 64robots/batch-notifications`

#### 2 - Publish

[](#2---publish)

`php artisan vendor:publish --provider="R64\BatchNotifications\BatchNotificationsServiceProvider"`

#### 3 - Run the migration that was just published

[](#3---run-the-migration-that-was-just-published)

`php artisan migrate`

Usage
-----

[](#usage)

#### 1 - Create you notification as you normally do, but add the "$eventables" parameter to the constructor:

[](#1---create-you-notification-as-you-normally-do-but-add-the-eventables-parameter-to-the-constructor)

```
class DocumentAssignedEmail extends Notification implements ShouldQueue
{
    use Queueable;

    /** @var Collection $eventables */
    private $eventables;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct(Collection $eventables)
    {
        $this->eventables = $eventables;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        if ($this->eventables->count() == 1) {
            return (new MailMessage)->view('mail.documents-assigned', [
                'user' => $notifiable,
                'document' => $this->eventables->first(),
            ])->subject("New Document Assigned");
        }

        return (new MailMessage)->view('mail.documents-assigned', [
            'user' => $notifiable,
            'documents' => $this->eventables,
        ])->subject("New Documents Assigned");
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}

```

#### 2 - Create the notification event for the intended notification:

[](#2---create-the-notification-event-for-the-intended-notification)

```
BatchNotificationEvent::queue(
    Auth::user(), /* The notifiable model instance. This can be any Notifiable Eloquent model */
    $document, /* The eventable instance you want to attach to the notification. All batch's eventables will be present on your notification constructor. This can be any Eloquent model. */
    DocumentAssignedEmail::class, /* The fully qualified name of your notification class */
    now()->addMinutes(2) /* The minimum interval that the notifiable model will be notified. In this example, the notifications will be sent every two minutes */
);

```

#### 3 - Add the command to your Console/Kernel.php file:

[](#3---add-the-command-to-your-consolekernelphp-file)

```
class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('batch-notifications:dispatch')->everyMinute();
    }

    //...
}

```

#### 4 - "mail.documents-assigned" view example:

[](#4---maildocuments-assigned-view-example)

```
@extends('layouts.email')

@section('content')

        Hello {{ $user->first_name }},

    @if (isset($document))

            A new document has been assigned to you: Document #{{ $document->id }}.

    @else

            New documents have been assigned to you:

            @foreach ($documents as $document)
                Document #{{ $document->id }}
            @endforeach

    @endif
@endsection

```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~261 days

Recently: every ~380 days

Total

9

Last Release

721d ago

PHP version history (2 changes)1.0PHP &gt;=7.1.0

1.0.6PHP &gt;=7.1.0|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/88e19e84d31e5f50eb2e338915669ae04f507a643fa24f88afc870520d8bef23?d=identicon)[64robots](/maintainers/64robots)

---

Top Contributors

[![NtimYeboah](https://avatars.githubusercontent.com/u/8011922?v=4)](https://github.com/NtimYeboah "NtimYeboah (8 commits)")[![jonrobinson](https://avatars.githubusercontent.com/u/1872553?v=4)](https://github.com/jonrobinson "jonrobinson (7 commits)")[![mmanzano](https://avatars.githubusercontent.com/u/1055699?v=4)](https://github.com/mmanzano "mmanzano (2 commits)")[![beliolfa](https://avatars.githubusercontent.com/u/12644599?v=4)](https://github.com/beliolfa "beliolfa (1 commits)")

---

Tags

laravelnotificationsbatch

### Embed Badge

![Health badge](/badges/64robots-batch-notifications/health.svg)

```
[![Health](https://phpackages.com/badges/64robots-batch-notifications/health.svg)](https://phpackages.com/packages/64robots-batch-notifications)
```

###  Alternatives

[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[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)
