Download the PHP package visualbuilder/email-templates without Composer

On this page you can find all versions of the php package visualbuilder/email-templates. 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 email-templates

Email Template Editor for Filament

Latest Version on Packagist Packagist Downloads run-tests GitHub last commit

Email Preview

Why businesses and applications should use Email Templates

This package provides:-

We use the standard Laravel mail sending capability, the package simply allows content editing and faster adding of new template Classes

Theme Editor

Email Preview

HTML Email Template Editor

Edit email content in the admin and use tokens to inject model or config content.

Email Preview

Version Compatibility

Package Version Filament Laravel PHP
5.x 5.x 11.x, 12.x 8.2+
4.x 4.x 10.x, 11.x 8.2+
3.x 3.x 10.x, 11.x 8.1+

Multitenancy

This package supports Filament's built-in multi-tenancy. When enabled, tenants can customise their own email templates while falling back to global system templates.

Enabling Multitenancy

Via Config

In config/filament-email-templates.php:

Via Plugin (Panel Provider)

Running the Migration

After enabling multitenancy, publish and run the migration to add the tenant column:

The migration adds a nullable tenant foreign key to both the vb_email_templates and vb_email_templates_themes tables.

How It Works

Template Fallback Chain

When retrieving a template (e.g. for sending an email), the package checks:

  1. Tenant-specific template — a template with the matching key AND the current tenant's ID
  2. Global template — a template with the matching key and a NULL tenant ID

This means tenants only need to create templates they want to customise. All other emails automatically use the global system templates.

In Filament Panels

Tenant users see both their own templates and global system templates in the resource list. When a tenant creates a new template, it is automatically assigned to their tenant.

Sending Emails

Pass the tenant ID explicitly when outside a Filament context (e.g. in queue workers or artisan commands):

Within a Filament panel, the tenant is resolved automatically from Filament::getTenant().

Cache Behaviour

Cache keys include the tenant context to prevent cross-tenant cache pollution. When a template is updated or deleted, both the tenant-specific and global cache entries are cleared to ensure the fallback chain stays consistent.

After enabling multitenancy on an existing installation, run php artisan cache:clear to reset stale cache keys.

Installation

Get the package via composer:

Running the install command will copy the template views, migrations, seeders and config file to your app.

The --seed option will populate 7 default templates which you can then edit in the admin panel.

Note: The seeder can also be edited directly if you wish to prepopulate with your own content. database\Seeders\EmailTemplateSeeder.php

Adding the plugin to a panel

Add this plugin to panel using plugins() method in app/Providers/Filament/AdminPanelProvider.php:

Menu Group and sort order can be set in the config

Enabling navigation

In the config file config/filament-email-templates.php navigation can be disabled/enabled

Or you can use a closure to enable navigation only for specific users:

Theme Screenshots

The package supports optional screenshot capture for email template themes. When configured, a "Capture" button appears on the theme list page that generates a preview image of how emails look with that theme's colours. Screenshots are stored via Spatie MediaLibrary on the EmailTemplateTheme model.

Configuring Screenshot Capture

Provide a screenshotCapture closure on the plugin. The closure receives the rendered email HTML string and should return ['image' => binary, 'contentType' => 'image/png'] or null.

When configured, the theme list page will show:

When screenshotCapture is not configured, these features are hidden and the package works exactly as before.

Screenshot Storage

Screenshots are stored as a screenshot media collection (single file) on the EmailTemplateTheme model. A thumb conversion (400x600, contain) is generated automatically for the list view.

The model implements Spatie\MediaLibrary\HasMedia, so you can access screenshots programmatically:

Usage

Tokens

Token format is ##model.attribute##. When calling the email pass any referenced models to replace the tokens automatically.

You can also include config values in the format ##config.file.key## eg ##config.app.name##.

In the email templates config file you must specify keys that are allowed to be replaced.

Implementing out of the box templates

Emails may be sent directly, via a notification or an event listener.

The following email templates are included to get you started and show different methods of sending.

Not all systems will require a login notification, but it's good practice for security so included here.

New User Registered Email

A new Registered event is triggered when creating a new user.

We want to welcome new users with a friendly email so we've included a listener for the Illuminate\Auth\Events\Registered Event which will send the email if enabled in the config:-

User Verify Email

This notification is built in to Laravel so we have overidden the default toMail function to use our custom email template.

For reference this is done in the EmailTemplatesAuthServiceProvider.

Important Register this provider so the override takes effect. Add Visualbuilder\EmailTemplates\EmailTemplatesAuthServiceProvider::class to the providers array in config/app.php (or within your own AppServiceProvider). Without this, Laravel will send its default verification email instead of your customised template.

This can be disabled in the config.

To Enable email verification ensure the User model implements the Laravel MustVerifyEmail contract:-

and include the verified middleware in your routes.

If you have a custom registration page and need to manually generate the verification URL, you can send the notification like this:

Note The notify() call must occur before logging in the user.

User Request Password Reset

Replacing the Filament default email requires extending the Filament RequestPasswordReset class to override the default request method like this:-

And then add this class into the admin panel provider:-

User Password Reset Success Notification

Customising the email template

Some theme colour options have been provided. Email templates will use the default theme unless you specify otherwise on the email template.

In the config file config/filament-email-templates.php logo, contacts, links and admin preferences can be set

If you wish to directly edit the template blade files, see the primary template here:

New templates in this directory will be automatically visible in the email template editor dropdown for selection.

Useful Tip

Not all email clients (e.g., Outlook) render CSS from a stylesheet effectively. To ensure maximum compatibility, it's best to put styles inline. For checking how your email looks across different clients, Litmus Email Previews is highly recommended.

Translations

Each email template is identified by a key and a language:

This allows the relevant template to be selected based on the users locale - You will need to save the users preferred language to implement this.

Please note laravel default locale is just "en" we prefer to separate British and American English so typically use en_GB and en_US instead but you can set this value as you wish.

Languages that should be shown on the language picker can be set in the config

Language Picker

Flag icons are loaded from CDN: https://cdn.jsdelivr.net/gh/lipis/[email protected]/css/flag-icons.min.css see https://www.npmjs.com/package/flag-icons

Creating new Mail Classes

We've currently opted to keep using a separate Mailable Class for each email type. This means when you create a new template in the admin, it will require a new php Class. The package provides an action to build the class if the file does not exist in app\Mail\VisualBuilder\EmailTemplates.

Build Class Currently generated Mailable Classes will use the BuildGenericEmail Trait

Including other models in the email for token replacement

Just pass through the models you need and assign them in the constructor.

In this example you can then use ##booking.date## or whatever attributes are available in the booking model.

If you need to derive some attribute you can add Accessors to your model.

Both of these function will allow you to use:-

##user.full_name## in the email template:-

OR

Adding Attachments

In here you can see how to pass an attachment:-

The attachment should be passed to the Mail Class and set as a public property.

In this case we've passed an Order model and an Invoice model which has a PDF.

Update From php8.0 the above code can be shortend to:_

The attachment is handled in the build function of the BuildGenericEmail trait. Customise the filename with attachment->filename You should also include the filetype.

Compatible with Laravel 11.x and 12.x mailable methods.

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The GNU GPLv3. Please see License File for more information.


All versions of email-templates with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/filament Version ^5.0
filament/spatie-laravel-media-library-plugin Version ^5.0
spatie/laravel-package-tools Version ^1.16
visualbuilder/filament-tinyeditor Version ^5.0|^6.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 visualbuilder/email-templates contains the following files

Loading the files please wait ...