PHPackages                             mail-map/laramail-map - 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. mail-map/laramail-map

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

mail-map/laramail-map
=====================

Laravel interface for mail-map

v1.1.2(9y ago)1273MITPHPPHP &gt;=5.6.22

Since Sep 8Pushed 9y agoCompare

[ Source](https://github.com/david-mk/laramail-map)[ Packagist](https://packagist.org/packages/mail-map/laramail-map)[ Docs](https://github.com/david-mk/laramail-map)[ RSS](/packages/mail-map-laramail-map/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

laramail-map
============

[](#laramail-map)

Laravel interface for mail-map

Requirements
============

[](#requirements)

- > = php 5.6
- php imap extension
- php mb\_string extension

Installation
============

[](#installation)

```
composer require mail-map/laramail-map

```

Usage
=====

[](#usage)

MailMap
-------

[](#mailmap)

See  for details on MailMap usage.

Setup
-----

[](#setup)

This provides an adapter for [MailMap](https://github.com/david-mk/mail-map) to be used within laravel. Simply publish the configuration with laravel's artisan `vendor:publish` command to make the configuration file `config/mailmap.php`. There you can provide credentials and configuration for MailMap to connect to your mail server.

The [LaraMailMapServiceProvider](https://github.com/david-mk/laramail-map/blob/master/src/LaraMailMap/LaraMailMapServiceProvider.php) injects basic [MailMap](https://github.com/david-mk/mail-map/blob/master/src/MailMap/MailMap.php) and [MailMap\\MailFactory](https://github.com/david-mk/mail-map/blob/master/src/MailMap/MailFactory.php) classes into the application container as singletons. You'll need to include this in the service provider section of your `config/app.php` if you only need the basics.

```
// config/app.php
'providers' => [
    // ... other providers
    LaraMailMap\LaraMailMapServiceProvider::class,
],
```

For more complex setups, you'll likely need to create your own service provider to handle different MailMap instances to your mailboxes/connections/mail-servers.

The LaraMailMap Extension: Mailboxes as Models
----------------------------------------------

[](#the-laramailmap-extension-mailboxes-as-models)

Depending on the size and scope of your application, it may be necessary to keep your emails objects separate from another, each with a different set of methods and properties that can manipulate your individual emails.

MailMap and in turn LaraMailMap are both designed to be as configurable as possible, allowing you access into each part of the library, so the specifics of this implementation is largely left to the developer.

However, the following is an example of how this can be approached by using the provided LaraMailMap extension of MailMap.

In this example, we're going to make a section of the application that is designed to handle emails that we get from github.(This requires that the emails are already in the desired mailbox. In gmail, this can be accomplished with filters and labels). Assume then that we already have our mail server setup with a mailbox called 'Github'.

First, we'll create an extension of the [LaraMailMap](https://github.com/david-mk/laramail-map/blob/master/src/LaraMailMap/LaraMailMap.php) class, which is itself an extension of [MailMap](https://github.com/david-mk/mail-map/blob/master/src/MailMap/MailMap.php).

You can put this wherever you like, but I'll put it in `app/MailMaps`.

```
// app/MailMaps/GithubMailMap.php
