sijanmahato / laravel-email-configuration
Database-driven email templates with admin API, placeholder replacement, and test send.
Package info
github.com/sijanmahato/laravel-email-configuration
pkg:composer/sijanmahato/laravel-email-configuration
Requires
- php: ^8.1
- illuminate/database: ^10.0|^11.0|^12.0
- illuminate/events: ^10.0|^11.0|^12.0
- illuminate/http: ^10.0|^11.0|^12.0
- illuminate/mail: ^10.0|^11.0|^12.0
- illuminate/routing: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- phpunit/phpunit: ^10.0|^11.0
This package is auto-updated.
Last update: 2026-05-15 04:01:45 UTC
README
Database-backed email templates with JSON API for CRUD, {{placeholder}} replacement, and test sends.
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
userstable (forcreated_by/updated_byforeign keys in the published migration)
Install
Published on Packagist as sijanmahato/laravel-email-configuration.
From Packagist (recommended)
composer require sijanmahato/laravel-email-configuration:^1.0
Use ^1.0 (or another semver range) so Composer respects minimum-stability: stable when you ship tagged releases.
From GitHub (VCS, optional)
Use this if you need a branch that is not on Packagist yet, or you are testing a fork:
composer config repositories.sijanmahato-laravel-email-configuration vcs https://github.com/sijanmahato/laravel-email-configuration.git composer require sijanmahato/laravel-email-configuration:dev-main
Local path package (adjust the path)
Add to your app composer.json:
{
"repositories": [
{
"type": "path",
"url": "./packages/laravel-email-configuration",
"options": { "symlink": true }
}
],
"require": {
"sijanmahato/laravel-email-configuration": "*"
}
}
Then run composer update.
After the package is installed
php artisan vendor:publish --tag=email-config-config php artisan vendor:publish --tag=email-config-migrations php artisan migrate
Configuration
Edit config/email-config.php:
route_prefix: URL segment for the package routes. If your HTTP kernel already prefixes API routes withapi, set this toapi/admin/email-configurations(or whatever matches your app).middleware: Stack applied to all routes. Replaceauth:sanctumwithauth:apior add permission middleware as needed.
Auditing
This package does not ship your application’s Auditable trait. Instead, the EmailConfiguration model dispatches:
Karja\EmailConfig\Events\EmailConfigurationCreatedKarja\EmailConfig\Events\EmailConfigurationUpdatedKarja\EmailConfig\Events\EmailConfigurationDeleted
Subscribe in your EventServiceProvider (or AppServiceProvider) and forward them to your audit logger.
Custom user id for created_by / updated_by
Bind your own resolver in a service provider:
use Illuminate\Support\ServiceProvider; use Karja\EmailConfig\Contracts\UserIdResolver; class AppServiceProvider extends ServiceProvider { public function register(): void { $this->app->singleton(UserIdResolver::class, function () { return new class implements UserIdResolver { public function resolve(): ?int { return auth()->id(); } }; }); } }
API
| Method | Path | Action |
|---|---|---|
| GET | /{prefix} |
List templates |
| GET | /{prefix}/{id} |
Show one |
| POST | /{prefix} |
Create |
| PUT | /{prefix}/{id} |
Update |
| DELETE | /{prefix}/{id} |
Delete |
| POST | /{prefix}/{id}/test-send |
Send test email |
Test send JSON body: { "to": "user@example.com", "variables": { "user_name": "Jane" } }.
Placeholders use {{variable_name}} in subject, HTML, and text bodies.
License
MIT.