Download the PHP package anikninja/mail-mapper without Composer

On this page you can find all versions of the php package anikninja/mail-mapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mail-mapper

πŸ“¬ Mail Mapper for Laravel

Mail Mapper is a standalone Laravel package that provides a dynamic, configurable email mapping and notification system.
It allows administrators or developers to define who receives which emails for specific module actions β€” without changing application code.

This package is ideal for ERP, CRM, and enterprise Laravel applications where email recipients frequently change.


✨ Features


πŸ“¦ Installation

Install via Composer:

Publish package resources:

Run migrations:

βš™οΈ Configuration

Config file location:

Example:

Authorization Configuration

The package provides configurable authorization options for the API and management UI. After publishing config/mail-mapper.php you can set the following under the authorization key (or via env variables):

Example configuration:

Notes:

πŸ—’οΈ ENV Example:

🧠 Core Concepts

Concept Description:

πŸ—„οΈ Database Structure

Email mappings are stored in:

Column Description
module Module name
menu Menu name
task Task/action
to Comma-separated email list
cc Optional CC emails
body Email body (HTML supported)
meta Holding placeholder attributes

πŸš€ Usage

βœ… Using Trait (Recommended)

βœ… Using Helper Function

Attachments

Pass attachments via the $extra parameter or the model context when calling notifyByMapping(...).

Supported formats:

Example usage:

Notes:

Parameters

Name Type Description
module string The module name (e.g., 'Sales'). Supports wildcard (*) to match any module.
menu string The feature or menu name (e.g., 'Lead Generation'). Supports wildcard (*) for flexible mapping.
task string The action or event name (e.g., 'Create', 'Update'). Supports wildcard (*) for generic or fallback templates.
modelOrContext Model | array An Eloquent model or associative array providing context for placeholders.
extra array (optional) Additional data (like: url, attachments) to merge into the context.
useRaw bool (optional) If true, bypasses mapping and sends a raw email directly.

πŸ”Ή Wildcard Matching

The Module, Menu, and Task parameters support the * wildcard to allow flexible mapping rules:

Example Description
module: '*' Matches any module (used as a global fallback).
menu: '*' Matches any feature or menu within the specified module.
task: '*' Matches all actions or events for a given module and menu.
module: 'Sales', menu: '*', task: 'Create' Matches all β€œCreate” actions under the Sales module, regardless of feature.

Wildcard support allows you to define general-purpose email templates that apply to multiple actions or modules β€” reducing redundancy and centralizing notification management.

βš™οΈ How It Works

1. Context Extraction

Builds a unified context array from the provided model or array, merging any extra data.

2. Meta Placeholder Management

Extracts all placeholders used in templates and stores them in the mapping’s meta field if not already present.

3. Recipient & Template Resolution

Uses EmailMappingService to resolve recipients, subject, and body dynamically, applying context placeholders.

4. Email Dispatch

Dispatches the fully rendered email through SendEmailNotificationJob for queued or asynchronous delivery.

πŸ—’οΈ Notes

πŸ“¨ Email Sending Strategy

The package automatically decides how to send email:

  1. Mailable (HTML template)
  2. Raw mail fallback if SMTP server rejects HTML mailables

You can force raw mode:

🎨 Email Template

Default template:

To customize:

πŸ§ͺ Queue Requirement

This package uses Laravel queues.

Run worker:

Recommended drivers:

βš™οΈ API

The package exposes a simple CRUD API for managing email mappings. Routes are published under the configured API prefix (default: /api) and are protected by middleware defined in config/mail-mapper.php.

Default endpoints (prefix may include version if configured):

Authentication & Authorization:

Example: Create mapping (cURL)

Response example (201 Created):

Notes:

🧰 Troubleshooting

Issue Solution
Mail not sent Check SMTP config
Job not running Run queue worker
Template not rendering Publish views
SMTP rejects HTML Enable use_raw

🧾 Summary

Mail Mapper is a standalone Laravel package that provides a dynamic, database-driven email notification system for modular applications. It enables module, menu, and task-based email routing without hardcoding recipient addresses in application code.

Built for enterprise-scale systems, Mail Mapper allows administrators to manage email recipients and content from the UI, while developers trigger notifications using a simple trait or helper. The package supports queued delivery, customizable HTML templates, and a raw SMTP fallback to ensure reliable email sending across different mail servers.


All versions of mail-mapper with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
illuminate/support Version ^10.0|^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package anikninja/mail-mapper contains the following files

Loading the files please wait ...