PHPackages                             bentonow/bento-laravel-sdk - 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. bentonow/bento-laravel-sdk

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

bentonow/bento-laravel-sdk
==========================

Laravel SDK for Bento

v1.3.3(1mo ago)2338.5k—8.2%6[3 issues](https://github.com/bentonow/bento-laravel-sdk/issues)[1 PRs](https://github.com/bentonow/bento-laravel-sdk/pulls)1MITPHPPHP &gt;=8.2CI passing

Since Sep 25Pushed 1mo ago3 watchersCompare

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

READMEChangelog (10)Dependencies (16)Versions (15)Used By (1)

Bento Laravel SDK
=================

[](#bento-laravel-sdk)

[![](https://camo.githubusercontent.com/ccd52ecdfaa83795016c4a0a4e4a63a9c2d1d786d3e6f379497421d5ce8be325/68747470733a2f2f6170702e62656e746f6e6f772e636f6d2f6272616e642f6c6f676f616e696d2e676966)](https://camo.githubusercontent.com/ccd52ecdfaa83795016c4a0a4e4a63a9c2d1d786d3e6f379497421d5ce8be325/68747470733a2f2f6170702e62656e746f6e6f772e636f6d2f6272616e642f6c6f676f616e696d2e676966)

Tip

Need help? Join our [Discord](https://discord.gg/ssXXFRmt5F) or email  for personalized support.

The Bento Laravel SDK makes it quick and easy to send emails and track events in your Laravel applications. We provide powerful and customizable APIs that can be used out-of-the-box to manage subscribers, track events, and send transactional emails. We also expose low-level APIs so that you can build fully custom experiences.

Get started with our [📚 integration guides](https://docs.bentonow.com), or [📘 browse the SDK reference](https://docs.bentonow.com/subscribers).

🐶 Battle-tested by [High Performance SQLite](https://highperformancesqlite.com/) (a Bento customer)!

❤️ Thank you [@aarondfrancis](https://github.com/aarondfrancis) for your contribution.

❤️ Thank you [@ziptied](https://github.com/ziptied) for your contribution.

[![Tests](https://github.com/bentonow/bento-laravel-sdk/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/bentonow/bento-laravel-sdk/actions/workflows/tests.yml)

Table of contents
=================

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Getting started](#getting-started)
    - [Installation](#installation)
    - [Configuration](#configuration)
- [Modules](#modules)
- [Things to Know](#things-to-know)
- [Contributing](#contributing)
- [License](#license)

Features
--------

[](#features)

- **Laravel Mail Integration**: Seamlessly integrate with Laravel's mail system to send transactional emails via Bento.
- **Event Tracking**: Easily track custom events and user behavior in your Laravel application.
- **Subscriber Management**: Import and manage subscribers directly from your Laravel app.
- **API Access**: Full access to Bento's REST API for advanced operations.
- **Laravel-friendly**: Designed to work smoothly with Laravel's conventions and best practices.

Requirements
------------

[](#requirements)

- PHP 8.2+ (8.1 supported but untested)
- Laravel 10.0+
- Bento API Keys

Getting started
---------------

[](#getting-started)

### Installation

[](#installation)

Install the package via Composer:

```
composer require bentonow/bento-laravel-sdk
```

### Configuration (Prompt-Based)

[](#configuration-prompt-based)

After installing, run the install command to set up your environment interactively:

```
php artisan bento:install
```

You will be prompted for:

- Your Bento Publishable Key
- Your Bento Secret Key
- Your Bento Site UUID
- Whether you want to enable Bento for transactional emails
- The author email for transactional mail (if transactional emails are enabled)
- Whether you want to send a test email after configuration
- Whether you want to automatically update your `.env` file

If you decline automatic `.env` modification, the command will display the required environment variables for you to copy and add manually. You will also see links to the [Bento Laravel documentation](https://docs.bentonow.com/laravel) and the [Bento app](https://app.bentonow.com).

> **Note:**The install command uses [Laravel Prompts](https://laravel.com/docs/12.x/prompts) for a modern, interactive setup experience. This requires Laravel 10+ and PHP 8.1+.

### Manual Configuration (Advanced)

[](#manual-configuration-advanced)

If you prefer, you can manually add the following to your `.env` file:

```
BENTO_PUBLISHABLE_KEY="your-publishable-key"
BENTO_SECRET_KEY="your-secret-key"
BENTO_SITE_UUID="your-site-uuid"
MAIL_MAILER=bento
MAIL_FROM_ADDRESS="author@example.com"
```

### Testing Your Configuration

[](#testing-your-configuration)

You can verify your transactional email configuration by running:

```
php artisan bento:test
```

This command will:

- Verify that Bento is configured as your default mailer
- Send a test email to your configured `MAIL_FROM_ADDRESS`
- Provide immediate feedback on the success or failure of the test

> **Note:**The test command requires Bento to be configured as your default mailer (`MAIL_MAILER=bento`) and a valid `MAIL_FROM_ADDRESS` to be set.

Modules
-------

[](#modules)

### Event Tracking

[](#event-tracking)

Track custom events in your application:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\EventData;

$data = collect([
  new EventData(
    type: '$completed_onboarding',
    email: "user@example.com",
    fields: [
      "first_name" => "John",
      "last_name" => "Doe"
    ]
  )
]);

return Bento::trackEvent($data)->json();
```

### Subscriber Management

[](#subscriber-management)

Import subscribers into your Bento account:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\ImportSubscribersData;

$data = collect([
  new ImportSubscribersData(
    email: "user@example.com",
    first_name: "John",
    last_name: "Doe",
    tags: ["lead", "mql"],
    removeTags: ["customers"],
    fields: ["role" => "ceo"]
  ),
]);

return Bento::importSubscribers($data)->json();
```

### Find Subscriber

[](#find-subscriber)

Search your site for a subscriber:

```
use Bentonow\BentoLaravel\Facades\Bento;

return Bento::findSubscriber("test@example.com")->json();
```

### Create Subscriber

[](#create-subscriber)

Creates a subscriber in your account and queues them for indexing:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\CreateSubscriberData;

$data = new CreateSubscriberData(email: "test@example.com");

return Bento::createSubscriber($data)->json();
```

### Run Command

[](#run-command)

Execute a command and change a subscriber's data:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\CommandData;
use Bentonow\BentoLaravel\Enums\Command;

$data = collect([
  new CommandData(Command::REMOVE_TAG, "test@gmail.com", "test")
]);

return Bento::subscriberCommand($data)->json();
```

### Get Tags

[](#get-tags)

Returns a list of tags in your account:

```
use Bentonow\BentoLaravel\Facades\Bento;

return Bento::getTags()->json();
```

### Create Tag

[](#create-tag)

Creates a custom tag in your account:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\CreateTagData;

$data = new CreateTagData(name: "example tag");

return Bento::createTag($data)->json();
```

### Get Fields

[](#get-fields)

The field model is a simple named key value pair, think of it as a form field:

```
use Bentonow\BentoLaravel\Facades\Bento;

return Bento::getFields()->json();
```

### Create Field

[](#create-field)

Creates a custom field in your account:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\CreateFieldData;

$data = new CreateFieldData(key: "last_name");

return Bento::createField($data)->json();
```

### Get Broadcasts

[](#get-broadcasts)

Returns a list of broadcasts in your account:

```
use Bentonow\BentoLaravel\Facades\Bento;

return Bento::getBroadcasts()->json();
```

### Create Broadcasts

[](#create-broadcasts)

Create new broadcasts to be sent:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\CreateBroadcastData;
use Bentonow\BentoLaravel\DataTransferObjects\ContactData;
use Bentonow\BentoLaravel\Enums\BroadcastType;

$data = Collect([
  new CreateBroadcastData(
    name: "Campaign #1 Example",
    subject: "Hello world Plain Text",
    content: "Hi {{ visitor.first_name }}",
    type: BroadcastType::PLAIN,
    from: new ContactData(
      name: "John Doe",
      emailAddress: "example@example.com"
    ),
    inclusive_tags: "lead,mql",
    exclusive_tags: "customers",
    segment_id: "segment_123456789",
    batch_size_per_hour: 1500
  ),
]);

return Bento::createBroadcast($data)->json();
```

### Get Site Stats

[](#get-site-stats)

Returns a list of site stats:

```
use Bentonow\BentoLaravel\Facades\Bento;

return Bento::getSiteStats()->json();
```

### Get Segment Stats

[](#get-segment-stats)

Returns a list of a segments stats:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\SegmentStatsData;

$data = new SegmentStatsData(segment_id: "123");

return Bento::getSegmentStats($data)->json();
```

### Get Report Stats

[](#get-report-stats)

Returns an object containing data for a specific report:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\ReportStatsData;

$data = new ReportStatsData(report_id: "456");

return Bento::getReportStats($data)->json();
```

### Search Blacklists

[](#search-blacklists)

Validates the IP or domain name with industry email reputation services to check for delivery issues:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\BlacklistStatusData;

$data = new BlacklistStatusData(domain: null, ipAddress: "1.1.1.1");
return Bento::getBlacklistStatus($data)->json();
```

### Validate Email

[](#validate-email)

Validates the email address using the provided information to infer its validity:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\ValidateEmailData;

$data = new ValidateEmailData(
  emailAddress: "test@example.com",
  fullName: "John Snow",
  userAgent: null,
  ipAddress: null
);

return Bento::validateEmail($data)->json();
```

### Moderate Content

[](#moderate-content)

An opinionated Content moderation:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\ContentModerationData;

$data = new ContentModerationData("Its just so fluffy!");
return Bento::getContentModeration($data)->json();
```

### Guess Gender

[](#guess-gender)

Guess a subscriber's gender using their first and last name. Best for US users; based on US Census Data:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\GenderData;

$data = new GenderData("John Doe");
return Bento::getGender($data)->json();
```

### Geolocate Ip Address

[](#geolocate-ip-address)

This endpoint attempts to geolocate the provided IP address:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\GeoLocateIpData;

$data = new GeoLocateIpData("1.1.1.1");
return Bento::geoLocateIp($data)->json();
```

### Get Email Template

[](#get-email-template)

Retrieve a single email template by ID:

```
use Bentonow\BentoLaravel\Facades\Bento;

return Bento::getEmailTemplate(123)->json();
```

### Update Email Template

[](#update-email-template)

Update an email template's subject and/or HTML content. Only the fields you provide will be updated:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\UpdateEmailTemplateData;

$data = new UpdateEmailTemplateData(
  id: 123,
  subject: "Updated Subject",
  html: "Updated content"
);

return Bento::updateEmailTemplate($data)->json();
```

### Get Sequences

[](#get-sequences)

Returns a list of sequences in your account. Supports pagination:

```
use Bentonow\BentoLaravel\Facades\Bento;

return Bento::getSequences()->json();

// With pagination
return Bento::getSequences(page: 2)->json();
```

### Create Sequence Email

[](#create-sequence-email)

Create a new email template within a sequence:

```
use Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\CreateSequenceEmailData;

$data = new CreateSequenceEmailData(
  sequenceId: "123",
  subject: "Day 1: Welcome!",
  html: "Thanks for signing up",
  delayInterval: "days",
  delayIntervalCount: 1
);

return Bento::createSequenceEmail($data)->json();
```

### Get Workflows

[](#get-workflows)

Returns a list of workflows in your account. Supports pagination:

```
use Bentonow\BentoLaravel\Facades\Bento;

return Bento::getWorkflows()->json();

// With pagination
return Bento::getWorkflows(page: 2)->json();
```

### Get Form Responses

[](#get-form-responses)

Get all responses for a form by its identifier:

```
use Bentonow\BentoLaravel\Facades\Bento;

return Bento::getFormResponses("my-form-id")->json();
```

### Tag Subscriber

[](#tag-subscriber)

Tag a subscriber with automation triggers:

```
use Bentonow\BentoLaravel\Facades\Bento;

Bento::tagSubscriber("user@example.com", "vip");
```

### Remove Tag

[](#remove-tag)

Remove a tag from a subscriber with automation triggers:

```
use Bentonow\BentoLaravel\Facades\Bento;

Bento::removeTag("user@example.com", "vip");
```

### Add Subscriber

[](#add-subscriber)

Add a subscriber with automation triggers:

```
use Bentonow\BentoLaravel\Facades\Bento;

Bento::addSubscriber("user@example.com", [
  "first_name" => "John",
  "last_name" => "Doe"
]);
```

### Remove Subscriber

[](#remove-subscriber)

Unsubscribe a subscriber with automation triggers:

```
use Bentonow\BentoLaravel\Facades\Bento;

Bento::removeSubscriber("user@example.com");
```

### Update Fields

[](#update-fields)

Update custom fields on a subscriber with automation triggers:

```
use Bentonow\BentoLaravel\Facades\Bento;

Bento::updateFields("user@example.com", [
  "plan" => "pro",
  "company" => "Acme Inc"
]);
```

### Track Purchase

[](#track-purchase)

Track a purchase for LTV calculation with automation triggers. Amounts should be in cents:

```
use Bentonow\BentoLaravel\Facades\Bento;

Bento::trackPurchase("user@example.com", [
  "unique" => ["key" => "order-123"],
  "value" => ["amount" => 9999, "currency" => "USD"],
  "cart" => [
    ["product_id" => "sku-1", "quantity" => 1, "price" => 9999]
  ]
]);
```

### Track

[](#track)

Track a custom event with automation triggers:

```
use Bentonow\BentoLaravel\Facades\Bento;

Bento::track(
  "user@example.com",
  '$completed_onboarding',
  fields: ["first_name" => "John"],
  details: ["step" => "final"]
);
```

### Upsert Subscriber

[](#upsert-subscriber)

Create or update a subscriber and return the record. Throws a `RuntimeException` if the import fails:

```
use Bentonow\BentoLaravel\Facades\Bento;

$subscriber = Bento::upsertSubscriber(
  email: "user@example.com",
  firstName: "John",
  lastName: "Doe",
  tags: ["lead", "website"],
  fields: ["role" => "ceo"]
);

return $subscriber->json();
```

> **Note:** If the import step fails (e.g. invalid data), a `RuntimeException` is thrown instead of returning a partial response. Wrap the call in a try/catch if you need to handle failures gracefully:
>
> ```
> try {
>     $subscriber = Bento::upsertSubscriber(email: "user@example.com");
> } catch (\RuntimeException $e) {
>     // Handle the failure
>     Log::warning($e->getMessage());
> }
> ```

Things to Know
--------------

[](#things-to-know)

1. The SDK integrates seamlessly with Laravel's mail system for sending transactional emails.
2. For event tracking and data importing, use the BentoConnector class.
3. All API requests are made using strongly-typed request classes for better type safety.
4. The SDK supports Laravel's environment-based configuration for easy setup across different environments.
5. For signed emails with return urls, please assign the `bento.signature` middleware or the `BentoSignatureExclusion::class`. This must be before the signed middleware to remove all utm and tracking url params.
6. Bento does not support `no-reply` sender addresses for transactional emails. You MUST use an author you have configured as your sender address.
7. For more advanced usage, refer to the [Bento API Documentation](https://docs.bentonow.com).

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

[](#contributing)

We welcome contributions! Please see our [contributing guidelines](CODE_OF_CONDUCT.md) for details on how to submit pull requests, report issues, and suggest improvements.

License
-------

[](#license)

The Bento SDK for Laravel is available as open source under the terms of the [MIT License](LICENSE.md).

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance86

Actively maintained with recent releases

Popularity41

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.8% 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 ~45 days

Recently: every ~91 days

Total

13

Last Release

53d ago

PHP version history (2 changes)1.0.1PHP &gt;=8.1

v1.3.3PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c3e74a41bec04bc53d5125b1e9f3f9a7978ec548c6f4405cbe7fe870d38f334?d=identicon)[bentonow](/maintainers/bentonow)

---

Top Contributors

[![ziptied](https://avatars.githubusercontent.com/u/379362?v=4)](https://github.com/ziptied "ziptied (79 commits)")[![jessehanley](https://avatars.githubusercontent.com/u/6285267?v=4)](https://github.com/jessehanley "jessehanley (33 commits)")[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (14 commits)")[![ericlbarnes](https://avatars.githubusercontent.com/u/116662?v=4)](https://github.com/ericlbarnes "ericlbarnes (6 commits)")[![coreymcmahon](https://avatars.githubusercontent.com/u/700486?v=4)](https://github.com/coreymcmahon "coreymcmahon (5 commits)")[![nick-potts](https://avatars.githubusercontent.com/u/1109914?v=4)](https://github.com/nick-potts "nick-potts (1 commits)")[![wojt-janowski](https://avatars.githubusercontent.com/u/209190810?v=4)](https://github.com/wojt-janowski "wojt-janowski (1 commits)")

---

Tags

emailtransactionallaravel-driverbentobentonow

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/bentonow-bento-laravel-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/bentonow-bento-laravel-sdk/health.svg)](https://phpackages.com/packages/bentonow-bento-laravel-sdk)
```

###  Alternatives

[mailersend/laravel-driver

MailerSend Laravel Driver

87732.8k4](/packages/mailersend-laravel-driver)[slot/mandrill-bundle

Symfony Mandrill Bundle

671.5M1](/packages/slot-mandrill-bundle)[mailersend/mailersend

MailerSend PHP SDK

801.0M7](/packages/mailersend-mailersend)[elastic-email/web-api-client

Easily send emails with Elastic Email using Web API PHP Client https://elasticemail.com/

22345.7k2](/packages/elastic-email-web-api-client)

PHPackages © 2026

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