PHPackages                             utyemma/laranotice - 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. utyemma/laranotice

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

utyemma/laranotice
==================

v1.0.2(1y ago)14051[1 PRs](https://github.com/UtyEmma/laranotice/pulls)MITPHPPHP &gt;=7.0

Since Apr 11Pushed 1y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Laranotice
==========

[](#laranotice)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1d1d064234c1580bdf84ca614206d69950e5405d6211f6dfd1483ad692d68263/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f757479656d6d612f6c6172616e6f746963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/utyemma/laranotice)[![Total Downloads](https://camo.githubusercontent.com/23a0fbf796bf67deea28428536d492aec195872a20b69b7c26dc5ca90841e318/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f757479656d6d612f6c6172616e6f746963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/utyemma/laranotice)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#)

Introducing LaraNotice, your go-to package for creating dynamic notifications and email messages effortlessly. LaraNotice allows you to craft and send your notifications with ease while taking advantage of Laravel's powerful built-in notification system.

Setup and Installation
----------------------

[](#setup-and-installation)

Install LaraNotice in your project

```
composer require utyemma/laranotice
```

If you intend to store your mail messages in your database, then you’ll be required to run migrations. (Note that this is the default setting)

```
php artisan migrate
```

Usage
-----

[](#usage)

#### Sending Notifications using the Mailable Class

[](#sending-notifications-using-the-mailable-class)

Genrate a mailable class

```
php artisan make:mailable ExampleMailable

```

#### Format your mail message

[](#format-your-mail-message)

```
    use App\Mailable\ExampleMailable;

    //Send your first notification message
    (new ExampleMailable)->send($user, ['mail', 'database']);
```

#### Sending Notifications using Laravel's Mail Message Format

[](#sending-notifications-using-laravels-mail-message-format)

Your can learn more about Laravel's default mail message formatting from the [Laravel Documentation](https://laravel.com/docs/11.x/notifications#formatting-mail-messages)

```
    use Utyemma\LaraNotice\Notify;
    use App\Models\User;

    $users = User::all();

    //Send your first notification message
    Notify::subject('Your Notification Subject')
                ->greeting('Hello!')
                ->line('You have a new message.')
                ->line('Thank you for using our application!');
                ->send($users, ['mail', 'database']);
```

Alternatively, if your wish to send a mail instead of create a notification, you can do so by replacing the send method with the 'mail' method

```
use Utyemma\LaraNotice\Notify;
use App\Models\User;

$recievers = ['admin@example.com', 'user@example.com'];

$data = [
    'name' => 'John Doe'
];

//Send your first notification message
(new Notify)->subject('Your Notification Subject', $data)
                ->greeting('Hello {{name}}')
                ->line('You have a new message.')
                ->line('Thank you for using our application!');
                ->mail($recievers);
```

Customizing the Templating Engine
---------------------------------

[](#customizing-the-templating-engine)

By default, this package makes use of [mustache](https://mustache.github.io/) as the default templating system to handle basic templating data. You can learn more about using mustache via the [php documentation](https://github.com/bobthecow/mustache.php)

However, you are free to use any custom template engine supported by PHP for your entire application or for a single mailable class. You can do so by registering custom template resolvers as shown below

#### Registering a custom template resolver for a specific mailable class

[](#registering-a-custom-template-resolver-for-a-specific-mailable-class)

This example sets the default resolver to make use of Laravel's blade templating engine. You can learn more about Laravel Blade [here](https://laravel.com/docs/11.x/blade)

```
    namespace App\Mailable;

    use Illuminate\Support\Facades\Blade;
    use Utyemma\LaraNotice\Notification;

    class ExampleMailable extends Notification {
        public function setResolver($content, $placeholders){
            return new Blade::render($content, $placeholders);
        }
    }
```

##### Configuring for all mailable classes

[](#configuring-for-all-mailable-classes)

Here is an example using handlebars templating engine. Learn more about using Handle Bars in your Laravel Application. [Handle Bars Docs](https://github.com/salesforce/handlebars-php)

1. Create a simple invokeable class that returns a static renderEngine method

```
    namespace App\Resolvers;

    use Handlebars\Handlebars;

    class HandleBarsResolver {

        function __invoke($content, $placeholders){
            return (new Handlebars)->render($content, $placeholders);
        }

    }
```

2. Update the 'resolver' item in your config file

```
    use App\Resolvers\HandleBarsResolver;

    return [
        'resolver' => HandleBarsResolver::class
    ];
```

> When this class is provided it will be used in resolving the templates. You must ensure your your mail messages are formatted based on the templating engine you are using as your resolver.

Deleting Mailables
------------------

[](#deleting-mailables)

LaraNotice provides a convenient command to clean up mailable classes and their associated database records.

```
# Delete a specific mailable class
php artisan mailable:delete --class=ExampleMailable

# Delete all mailable classes
php artisan mailable:delete --all

# Delete with preservation options
php artisan mailable:delete --class=ExampleMailable --preserve=database  # Only deletes the file
php artisan mailable:delete --class=ExampleMailable --preserve=files     # Only deletes from database
```

### Command Options

[](#command-options)

- `--all`: Delete all mailable classes and their database records
- `--class=`: Specify a single mailable class to delete (e.g., ExampleMailable)
- `--preserve=`: Optional. Specify what to keep:
    - `database`: Preserves database records but deletes files
    - `files`: Preserves files but deletes database records

The command will ask for confirmation before performing any deletions to prevent accidental data loss.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Utibe-Abasi Emmanuel](https://github.com/UtyEmma)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance42

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 62.5% 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 ~138 days

Total

3

Last Release

483d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/55f18141894daa277e3d98b6c1211a2a991fa2b9e83c18b3613af10ba2324b72?d=identicon)[utyemma](/maintainers/utyemma)

---

Top Contributors

[![UtyEmma](https://avatars.githubusercontent.com/u/49941118?v=4)](https://github.com/UtyEmma "UtyEmma (5 commits)")[![kazburrel](https://avatars.githubusercontent.com/u/87763251?v=4)](https://github.com/kazburrel "kazburrel (3 commits)")

---

Tags

laranoticelaravellaravel-notificationsnotificationsnotificationslaravel-notificationsLaraNotice

### Embed Badge

![Health badge](/badges/utyemma-laranotice/health.svg)

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

###  Alternatives

[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[thomasjohnkane/snooze

Schedule future notifications and reminders in Laravel

9321.5M2](/packages/thomasjohnkane-snooze)[paragraph1/php-fcm

PHP application server for google firebase cloud messaging (FCM)

1991.2M10](/packages/paragraph1-php-fcm)[alymosul/exponent-server-sdk-php

Server-side library for working with Expo push notifications using PHP

1541.5M14](/packages/alymosul-exponent-server-sdk-php)[liran-co/laravel-notification-subscriptions

Notification subscription management.

128239.2k1](/packages/liran-co-laravel-notification-subscriptions)[edwinhoksberg/php-fcm

A library for sending Firebase cloud messages and managing user topic subscriptions, device groups and devices.

68328.5k1](/packages/edwinhoksberg-php-fcm)

PHPackages © 2026

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