Download the PHP package crow/laravel-email-template without Composer
On this page you can find all versions of the php package crow/laravel-email-template. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download crow/laravel-email-template
More information about crow/laravel-email-template
Files in crow/laravel-email-template
Informations about the package laravel-email-template
Description
- command for sync email templates table in database
- all email templates in seeder file
- global and personal variables for each email template
- storage location of your choice (in blade templates or database)
- text for custom variables via lexicon file
- wrapper template for all email templates (blade)
Install
Open file bootstrap/providers.php and connect the provider from the package (optional, using laravel discovered package system by default)
2. Run commands
For creating config file
For creating lexicon file
For creating migration file
For generate table
Next steps install
1. Create seeder file if not exists for email templates.
In the created seed file, you need to add a static method (for example, public static function data()).
The method must return an array of standard to fill the database
2. Open config file config/email_template.php and add this class and method in exists parameters
3 Example content seeder file database/seeders/EmailTemplateTableSeeder.php
Command for sync email templates
Usage
Eloquent model for use.
You can use helper \Crow\LaravelEmailTemplate\Helpers\EmailTemplateHelper or service \Crow\LaravelEmailTemplate\Services\EmailTemplateService.
further we will use the variable $emailTemplate as a model of Email Template
Email template parse short codes
Reset config to default
Override email template wrapper
Blade template are used
The procedure of adding new common variable
Variables will be valid in all email templates
-
Open file config/email_template.php and add custom variable in section variables - global, example:
- Create class \App\CustomEmailTemplateVariableSiteName
- The class must be an implementation of the interface Crow\LaravelEmailTemplate\EmailTemplateVariableInterface
- The class must contain a public method content(EmailTemplate $emailTemplate): ?string
Full example file
Procedure for adding template variable descriptions (optional)
These lists do not affect the variables used in templates, this may only be required to display a list of available variables for a specific email template type.
-
Open file config/email_template.php and add custom variable in section variables - type, example:
- Add text for variables in to lexicon file lang/LANG_KEY/email_template.php, section variables - common or variables - type
- Get a list of variables for a specific email template