PHPackages                             shaz3e/email-builder - 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. shaz3e/email-builder

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

shaz3e/email-builder
====================

Create Email from frontend and use palceholder within email

v1.0.1(5mo ago)01.2k↓90%1MITPHP

Since Apr 24Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/Shaz3e/email-builder)[ Packagist](https://packagist.org/packages/shaz3e/email-builder)[ RSS](/packages/shaz3e-email-builder/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)DependenciesVersions (17)Used By (0)

Email Builder
=============

[](#email-builder)

A powerful Laravel package for managing dynamic email templates with placeholders, global layouts, and safe image handling — without creating new Mailables for every email.

[![Packagist Version](https://camo.githubusercontent.com/055b357f209a688bc70b0338918da7ff10d72397f7c41bc891c10219fafd44cb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7368617a33652f656d61696c2d6275696c646572)](https://camo.githubusercontent.com/055b357f209a688bc70b0338918da7ff10d72397f7c41bc891c10219fafd44cb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7368617a33652f656d61696c2d6275696c646572)[![Packagist Downloads](https://camo.githubusercontent.com/68866fa36c6745dc0bf512f5ca9e8c2fcbed47f840086753a58afeb401593a90/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7368617a33652f656d61696c2d6275696c646572)](https://camo.githubusercontent.com/68866fa36c6745dc0bf512f5ca9e8c2fcbed47f840086753a58afeb401593a90/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7368617a33652f656d61696c2d6275696c646572)[![License](https://camo.githubusercontent.com/9bd25f22af99783ce53627a59cbc20a5ab9128b7cfe1ad6d1bda9b2e163e1af6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7368617a33652f656d61696c2d6275696c646572)](https://camo.githubusercontent.com/9bd25f22af99783ce53627a59cbc20a5ab9128b7cfe1ad6d1bda9b2e163e1af6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7368617a33652f656d61696c2d6275696c646572)[![Laravel Version](https://camo.githubusercontent.com/b636eab27ab9bc454ff6d7b435d8e048004aa20014303b8b3cd5b25d863b06b1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31322e782d626c7565)](https://camo.githubusercontent.com/b636eab27ab9bc454ff6d7b435d8e048004aa20014303b8b3cd5b25d863b06b1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31322e782d626c7565)

---

Introduction
------------

[](#introduction)

**Email Builder** allows you to manage email templates directly from your application database using dynamic placeholders such as `{name}`, `{app_url}`, etc.

It is designed for **real production systems**, where:

- Emails must remain valid even months later
- Images should not break historical emails
- Templates are managed dynamically (not hardcoded Mailables)
- Global headers and footers are reusable
- Multiple applications or tenants may exist

Typical use cases:

- Welcome emails
- Email verification
- Password reset
- Order confirmations
- System notifications

---

Features
--------

[](#features)

- Database-driven email templates
- Dynamic placeholders
- Optional global header &amp; footer
- Inline CSS for maximum email-client compatibility
- Safe image handling (no broken historical emails)
- Optional image cleanup via Artisan command
- Queue or send instantly (configurable)
- No need to create new Mailable classes

---

Installation
------------

[](#installation)

Install via Composer:

```
composer require shaz3e/email-builder
```

---

Publish Package Assets
----------------------

[](#publish-package-assets)

### Publish Views

[](#publish-views)

```
php artisan vendor:publish --tag=email-builder-views
```

### Publish Config (Recommended)

[](#publish-config-recommended)

```
php artisan vendor:publish --tag=email-builder-config
```

### Publish Migrations

[](#publish-migrations)

> ⚠️ Configure the package **before** running migrations.

```
php artisan vendor:publish --tag=email-builder-migrations
php artisan migrate
```

---

Quick Start
-----------

[](#quick-start)

Send your first email in minutes.

```
use Shaz3e\EmailBuilder\Services\EmailBuilderService;

$emailBuilder = new EmailBuilderService();

$emailBuilder->sendEmailByKey(
    'welcome_email',
    'user@example.com',
    [
        'name' => 'John Doe',
        'app_name' => config('app.name'),
        'app_url' => route('verification.notice'),
    ]
);
```

> Ensure the `welcome_email` template exists in the database.

---

Core Concepts
-------------

[](#core-concepts)

### Email Templates

[](#email-templates)

Stored in the database and identified by a unique `key`.

### Global Header &amp; Footer

[](#global-header--footer)

Reusable layout applied across templates when enabled.

### Placeholders

[](#placeholders)

Dynamic variables like `{name}` replaced at send time.

### Images

[](#images)

Images are stored on disk and referenced via **absolute URLs** to ensure compatibility across all email clients.

---

Configuration
-------------

[](#configuration)

`config/email-builder.php`

```
return [

    'image' => [
        'allowed_extensions' => ['jpg', 'jpeg', 'png', 'gif'],
        'max_size' => 2048,
    ],

    'queue_emails' => false,

    'log_info' => false,

    'body_column_type' => 'longText',

    'image_cleanup' => [
        'enabled' => true,
        'retention_days' => 180,
        'disk' => 'public',

        'directories' => [
            'global' => [
                'images/email-builder/global-email/header-images',
                'images/email-builder/global-email/footer-images',
                'images/email-builder/global-email/footer-bottom-images',
            ],

            'templates' => [
                'images/email-builder/email-templates/header-images',
                'images/email-builder/email-templates/footer-images',
                'images/email-builder/email-templates/footer-bottom-images',
            ],
        ],
    ],
];
```

---

Request Validation Example
--------------------------

[](#request-validation-example)

```
use App\Rules\ImageRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class StoreEmailTemplateRequest extends FormRequest
{
    protected function prepareForValidation(): void
    {
        $this->merge([
            'use_global_header' => $this->boolean('use_global_header') ? 1 : 0,
            'use_global_footer' => $this->boolean('use_global_footer') ? 1 : 0,
        ]);
    }

    public function rules(): array
    {
        return [
            'use_global_header' => ['required', 'in:0,1'],
            'use_global_footer' => ['required', 'in:0,1'],

            'header_image' => ['nullable', 'required_if:use_global_header,0', new ImageRule],
            'header_text' => ['required_if:use_global_header,0', 'string'],
            'header_text_color' => ['required_if:use_global_header,0', 'string'],
            'header_background_color' => ['required_if:use_global_header,0', 'string'],

            'footer_image' => ['nullable', 'required_if:use_global_footer,0', new ImageRule],
            'footer_text' => ['required_if:use_global_footer,0', 'string'],
            'footer_text_color' => ['required_if:use_global_footer,0', 'string'],
            'footer_background_color' => ['required_if:use_global_footer,0', 'string'],

            'key' => ['required', 'string', Rule::unique('email_templates', 'key')],
            'name' => ['required', 'string'],
            'subject' => ['required', 'string'],
            'body' => ['required', 'string'],
        ];
    }
}
```

---

Image Retention Policy
----------------------

[](#image-retention-policy)

- Images are **never deleted automatically**
- Prevents broken historical emails
- Cleanup is explicit and controlled

### Cleanup Command

[](#cleanup-command)

```
php artisan email-builder:cleanup-images
php artisan email-builder:cleanup-images --days=180
php artisan email-builder:cleanup-images --force
```

---

Email Client Compatibility
--------------------------

[](#email-client-compatibility)

Designed for:

- Gmail (web &amp; mobile)
- Outlook (Windows &amp; macOS)
- Yahoo Mail
- iCloud Mail
- Hotmail
- Custom webmail clients

Uses conservative HTML and inline CSS.

---

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

[](#contributing)

Pull requests are welcome.

GitHub:

---

License
-------

[](#license)

Email Builder is licensed under the **MIT License**.

---

Credits
-------

[](#credits)

- **Shaz3e** –
- **Diligent Creators** –

[![GitHub commit activity](https://camo.githubusercontent.com/e032d6fa502d1e50c962144b3cccb4a91eb346cd2777a6d948b1c0b1d35d6af2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d69742d61637469766974792f6d2f7368617a33652f656d61696c2d6275696c646572)](https://camo.githubusercontent.com/e032d6fa502d1e50c962144b3cccb4a91eb346cd2777a6d948b1c0b1d35d6af2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d69742d61637469766974792f6d2f7368617a33652f656d61696c2d6275696c646572)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance70

Regular maintenance activity

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.3% 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 ~17 days

Recently: every ~0 days

Total

16

Last Release

169d ago

Major Versions

v0.8.4 → v1.02026-01-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/55fa895f3ba767604ea0fc6cc1a6f7fc69e9fb73de02886a770fd75ab886fbbc?d=identicon)[Shaz3e](/maintainers/Shaz3e)

---

Top Contributors

[![Shaz3e](https://avatars.githubusercontent.com/u/526602?v=4)](https://github.com/Shaz3e "Shaz3e (36 commits)")[![MUHAMMADSiyab](https://avatars.githubusercontent.com/u/39950367?v=4)](https://github.com/MUHAMMADSiyab "MUHAMMADSiyab (1 commits)")

### Embed Badge

![Health badge](/badges/shaz3e-email-builder/health.svg)

```
[![Health](https://phpackages.com/badges/shaz3e-email-builder/health.svg)](https://phpackages.com/packages/shaz3e-email-builder)
```

###  Alternatives

[mattketmo/email-checker

Throwaway email detection library

2752.1M5](/packages/mattketmo-email-checker)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.5k](/packages/sarfraznawaz2005-noty)

PHPackages © 2026

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