PHP Localbox

A simple inbox for local development. View emails without actually sending any email!

Why?

Configuring email in a local PHP development environment such as WampServer or XAMP can be needlessly challenging. Sometimes you just need a simple way to confirm that an email will be triggered at the correct time to the correct recipient, with the correct subject line and correct message content.

Localbox is a simple two-file PHP/MySQL application. You can easily incorporate it into your existing workflow to route all of your email messages into your Localbox when developing locally. Messages are stored in a database table instead of actually being sent.

You can then view them in your Localbox, which is designed to look and feel like an actual inbox. Localbox is open-source, supports both plain text and HTML email messages, and has a responsive design for testing on mobile devices.

Use Cases

Screenshots

Here's what a Localbox "inbox" looks like:

PHP Localbox Inbox

And here's what an HTML message looks like:

PHP Localbox Message

Basic Usage Example

In your codebase, initiate the Localbox class and "send" a message:

$localbox = new Localbox;
$localbox->Mail($sender, $recipient, $subject, $message, $sender_name, $reply_to, $headers);

Localbox was designed to integrate into your existing workflow. Instead of attempting and failing to send an email in your local environment, or skipping over sending an email, you can instead save that message to your Localbox. For example, you might have defined a variable LOCAL_ENVIRONMENT that is set to TRUE when developing locally and FALSE in staging or production environments.

In the past you might have:

if (!LOCAL_ENVIRONMENT) {
//send email using PHP's mail() function, PHPMailer, or any other method
}

Whereas with Localbox you can do:

if (!LOCAL_ENVIRONMENT) {
//send email using PHP's mail() function, PHPMailer, or any other method
} else {
$localbox = new Localbox;
$localbox->Mail($sender, $recipient, $subject, $message, $sender_name, $reply_to, $headers);
}

Download & Install

Get started by visiting our GitHub page. There you'll find detailed installation instructions, FAQs, demo emails, and more.

View on GitHub

About

PHP Localbox was created by Adam McFarland for internal use within Pure Adapt, Inc. Special thanks to the Skeleton CSS framework, which is used for the layout of Localbox.