PHPackages                             theoafactor/messenger - 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. theoafactor/messenger

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

theoafactor/messenger
=====================

Handles sending email messages to users

v1.2.0(4y ago)1221MITPHP

Since Mar 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/theoafactor/messenger)[ Packagist](https://packagist.org/packages/theoafactor/messenger)[ RSS](/packages/theoafactor-messenger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (10)Used By (0)

Messenger
---------

[](#messenger)

### An email and message sender.

[](#an-email-and-message-sender)

1. Easily sends emails to users
2. Add the project

```
	composer require theoafactor/messenger

```

3. Add the following lines at the top of your project:

```
require "vendor/autoload.php";

use Messenger\Messenger;

```

4. Create an instance of the Messenger class

```
	$messeger = new Messenger();

```

5. Send your email.

```
	$messenger->sendMessage('recepient@email.com', 'Message Subject', $extra_data_array, "email_template.html");

```

6. The sendMessage() method takes the following arguments:

    - recepient's email address
    - email subject
    - some extra data in the form of associative array
    - the file path of email template to be used
7. Of all the arguments, the recepient's email address and email subject are compulsory, while the others are not. But it's a good thing to set these arguments.

### Setting Environmental Values

[](#setting-environmental-values)

1. You should set the environmental values with .env file at the root of your project. Please use the .env.example file as an example.
2. Create a .env file and copy the sample from .env.example file inside theoafactor/messenger/src directory over.
3. Supply the data.

### Using Email Templates

[](#using-email-templates)

1. The package uses a mini template engine. The engine will look for your email template in the root of the directory.
2. Variables are outputted with {{ variable\_name }} within the template.
3. Variables data come from the extra data associative array passed to the sendMessage() method. For example, in the code below, we have set the extra data associate array to have the firstname and lastname keys.

```
	$userData = [

		"firstname" => "James",
		"lastname"  => "John"

	];

```

4. In the email template, we can reference the firstname key by using:

    ```

    		Welcome {{ firstname }}

    ```

### Loops

[](#loops)

1. This package uses basic looping mechanism and only supports the foreach loop. To loop through an array in the template, follow the sample below:

```
	@foreach(arrayKey as item)
		{{ item }}
	@endforeach

```

2. Remember that the *arrayKey* comes from the data you passed to the sendMessage() method.
3. Support for *nested loops* has not been added.
4. Support for *conditional statements* has not been added.

### Note

[](#note)

1. This project is actively under development. You may use it for your project. You may also contribute to this project by creating a pull request.
2. Please report any security issue as soon as you spot one.

### Author: Olu Adeyemo \[\]

[](#author-olu-adeyemo-theoafactorgmailcom)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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

Total

8

Last Release

1532d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a5b1cbcaad231f9a545172a263c623e6f40068946b92da7ad490685c84bd8153?d=identicon)[theoafactor](/maintainers/theoafactor)

---

Top Contributors

[![theoafactor](https://avatars.githubusercontent.com/u/13960537?v=4)](https://github.com/theoafactor "theoafactor (21 commits)")

### Embed Badge

![Health badge](/badges/theoafactor-messenger/health.svg)

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

###  Alternatives

[ivantcholakov/codeigniter-phpmailer

A CodeIgniter 3 compatible email-library powered by PHPMailer.

25313.9k](/packages/ivantcholakov-codeigniter-phpmailer)[markguinn/silverstripe-email-helpers

Silverstripe extension containing SMTP mailer class and some other classes for HTML emails

3145.4k1](/packages/markguinn-silverstripe-email-helpers)[msp/smtp

SMTP with PHPMailer

2129.4k](/packages/msp-smtp)[nfephp-org/sped-mail

API para geração e envio dos emails relacionados com o SPED.

1123.7k](/packages/nfephp-org-sped-mail)

PHPackages © 2026

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