PHPackages                             fivesqrd/fluent-frontier - 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. [API Development](/categories/api)
4. /
5. fivesqrd/fluent-frontier

ActiveLibrary[API Development](/categories/api)

fivesqrd/fluent-frontier
========================

Client side wrapper to the Fluent Web Service

06PHP

Since Oct 30Pushed 7y ago1 watchersCompare

[ Source](https://github.com/fivesqrd/fluent-frontier-php)[ Packagist](https://packagist.org/packages/fivesqrd/fluent-frontier)[ RSS](/packages/fivesqrd-fluent-frontier/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Fluent for PHP
==============

[](#fluent-for-php)

The PHP client for the Fluent Web Service. Fluent is a simple and elegant way to create and send transactional emails from your web or mobile app.

Install
-------

[](#install)

To get Fluent for PHP installed simply pull in the composer package:

```
composer require fivesqrd/fluent:4.*

```

For Laravel projects there is an easy to install package available

```
composer require fivesqrd/fluent-laravel

```

More info on the Laravel config options and the Fluent facade is available here:

### Benefits

[](#benefits)

- Provides consistency between development, staging and production environments
- Safe email testing sandbox that won't spam your users
- Email logs with 60 day content retention period
- Less wrestling with tables and CSS inlining using [Jit](http://fluentmsg.com/jit)

Register
--------

[](#register)

To send messages you'll first need to [register](http://fluentmsg.com) Fluent account. Once registered, you'll receive API key to start sending messages immediately.

Instantiating Objects
---------------------

[](#instantiating-objects)

Passing config to the Message object at run time:

```
$config = [
    'key'           => null, // Fluent access key
    'secret'        => null, // Fluent access secret
    'headers'       => null, // Optional default sender
];

$delivery = (new Fluent\Delivery($config))->create();
$events = (new Fluent\Event($config))->find();

```

To make bootstrapping eaiser, we've provided a way to preload config by assigning options to the static $defaults property of the Factory class:

```
Fluent\Factory::$defaults = [
    'key'           => null, // Fluent access key
    'secret'        => null, // Fluent access secret
    'headers'       => null, // Optional default sender
];

$message = Fluent\Factory::message()->create();
$events = Fluent\Factory::event()->create();

```

Message Delivery
----------------

[](#message-delivery)

One can easily deliver the message by combining the message body with the Fluent Web Service client.

```
$body = (new Fluent\Body())
    ->title('My little pony')
    ->paragraph('Lorem ipsum dolor sit amet, consectetur adipiscing elit.')
    ->number(['caption' => 'Today', 'value' => date('j M Y')])
    ->button('http://www.mypony.com', 'Like my pony')
    ->paragraph('Pellentesque habitant morbi tristique senectus et netus et malesuada fames.');

$messageId = (new Fluent\Delivery())->create()
    ->content($body)
    ->subject('Testing it')
    ->from('me@myapp.com', 'My App')
    ->to('user@theirdomain.com')
    ->send();

```

The following methods are provided to set up the delivery of the message:

### subject($text)

[](#subjecttext)

```
/* Add a subject to the message */
$message->subject('Lorem ipsum dolor');

```

### header($key, $value) or headers($values)

[](#headerkey-value-or-headersvalues)

```
/* Add a header to the message */
$message->header('Reply-To', 'me@myapp.com');

```

```
/* Add multiple headers to the message */
$message->headers(array(
    'Reply-To', 'me@myapp.com',
    'X-Fluent', 'lorem'
));

```

### from($address, $name = null)

[](#fromaddress-name--null)

```
/* Set the sender address and name */
$message->from('me@myapp.com', 'My App');

```

### to($address, $name = null)

[](#toaddress-name--null)

Note: only one recipient can be provided per message.

```
/* Set the recipient address and name */
$message->to('user@theirdomain.com');

```

### attach($filename, $mimetype, $blob) or attachments($values)

[](#attachfilename-mimetype-blob-or-attachmentsvalues)

```
/* Add an attachment to the message */
$message->attach('My-Attachment.pdf', 'application/pdf', file_get_contents($file))

```

```
/* Add multiple attachments to the message */
$message->attachments(array(
    ['name' => 'My-First-File.pdf', 'type' => 'application/pdf', 'content' => file_get_contents($file)],
    ['name' => 'My-2nd-File.jpg', 'type' => 'image/jpg', 'content' => file_get_contents($file2)],
));

```

### send()

[](#send)

Send is the final method of the chain and should always be called last. It delivers to message to the Fluent Web Service and returns a unique message ID.

```
/* Send the message */
$messageId = $message->send();

```

Templates
---------

[](#templates)

It's possible to simplify the body construction and message delivery with pre-built template classes:

```
/* Double action: construct and send */
$template = new MyApp\Template\PasswordReset($params);

$messageId = (new Fluent\Delivery())->from($template)->send();

```

Additional Features
-------------------

[](#additional-features)

Sending with custom headers

```
$messageId = (new Fluent\Delivery())->create()
    ->content($body)
    ->header('Reply-To', 'me@myapp.com')
    ->to('user@theirdomain.com')
    ->send();

```

Sending with attachments

```
$messageId = (new Fluent\Delivery())->create()
    ->content($body)
    ->subject('Testing it')
    ->attach('My-Attachment.pdf', 'application/pdf', file_get_contents($file))
    ->to('user@theirdomain.com')
    ->send();

```

More Web Service Features
-------------------------

[](#more-web-service-features)

### Resending a message

[](#resending-a-message)

In most cases resending an email notification is hard because it has to be recreated again, but the application state has since changed. With Fluent it is possible to simply resend a snapshot of the original message. Optionally specify a different recipient.

```
$response = (new Fluent\Delivery())->resend($messageId)
    ->to('other@theirdomain.com')
    ->send();

```

### Retrieving a sent message

[](#retrieving-a-sent-message)

```
$response = (new Fluent\Message())->get($messageId)->fetch();

```

### Searching sent messages

[](#searching-sent-messages)

```
$response = (new Fluent\Message())->find()
    ->from('me@myapp.com')
    ->to('user@theirdomain.com')
    ->since(date('Y-m-d H:i:s', strtotime('-2 days ago')))
    ->fetch();

```

### Find events

[](#find-events)

Get delivery progress updates for a particular recipient address

```
$response = (new Fluent\Event())->find()
    ->to('user@theirdomain.com')
    ->since(date('Y-m-d H:i:s', strtotime('-2 days ago')))
    ->type(['hard_bounce', 'soft_bounce', 'reject'])
    ->fetch();

```

Alternative Formats
-------------------

[](#alternative-formats)

Somtimes you need to send plain text or custom HTML emails. Fluent provides a way to do this:

### Plain Text

[](#plain-text)

```
$messageId = (new Fluent\Message())->create('This is my plain text message body')
    ->subject('Testing it')
    ->header('Reply-To', 'me@myapp.com')
    ->to('user@theirdomain.com')
    ->send();

```

### Custom HTML

[](#custom-html)

```
$html = 'This is my custom HTML message body';

$messageId = (new Fluent\Message())->create(new Fluent\Message\Content\Raw($html))
    ->subject('Testing it')
    ->header('Reply-To', 'me@myapp.com')
    ->to('user@theirdomain.com')
    ->send();

```

Generate HTML locally
---------------------

[](#generate-html-locally)

Instead of delivering the message it is possible to render a HTML document locally. For this we used one of our open source email designs called Musimal and wrapped it inside a PHP library. It accepts a Body object as argument and returns a responsive HTML email body as a string.

```
# add the open source HTML wrapper to the project
composer require fivesqrd/fluent-musimal

```

Generate a responsive HTML string from the body object:

```
/* Predefine the HTML rendering options */
$options = array(
    'logo'          => 'My App', //Plain text or publicly available URL. Image not wider than 200px
    'color'         => '#ff6600', //Primary colour
    'footer'        => 'My test generated by Musimal for PHP', //Text at bottom of all messages
);

/* Construct a message body */
$body = (new Fluent\Body())
    ->title('My little pony')
    ->paragraph('Lorem ipsum dolor sit amet, consectetur adipiscing elit.')
    ->number(['caption' => 'Today', 'value' => date('j M Y')])
    ->button('http://www.mypony.com', 'Like my pony')
    ->paragraph('Pellentesque habitant morbi tristique senectus et netus et malesuada fames.');

/* Render the body to an HTML document */
$html = (new Fluent\Layout($options))->render($body);

```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/43279?v=4)[christianjburger](/maintainers/christianjburger)[@christianjburger](https://github.com/christianjburger)

---

Top Contributors

[![christianjburger](https://avatars.githubusercontent.com/u/43279?v=4)](https://github.com/christianjburger "christianjburger (139 commits)")

### Embed Badge

![Health badge](/badges/fivesqrd-fluent-frontier/health.svg)

```
[![Health](https://phpackages.com/badges/fivesqrd-fluent-frontier/health.svg)](https://phpackages.com/packages/fivesqrd-fluent-frontier)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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