escolalms / templates-email
Escola Headless LMS Templates for Emails
Installs: 8 226
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires
- php: >=7.4
- escolalms/core: ^1.2.2
- escolalms/templates: ^0.2.1
- ezyang/htmlpurifier: ^4.13
- laravel/framework: >=8.0
- qferr/mjml-php: ^2
Requires (Dev)
- escolalms/assign-without-account: ^0
- escolalms/auth: ^0.2
- escolalms/cart: ^0
- escolalms/consultation-access: ^0
- escolalms/consultations: ^0
- escolalms/course-access: ^0
- escolalms/courses: ^0.4
- escolalms/csv-users: ^0.1.0
- escolalms/payments: ^0
- escolalms/permissions: ^0
- escolalms/settings: ^0.1.2
- escolalms/tasks: ^0
- escolalms/topic-type-project: ^0
- escolalms/topic-types: ^0
- escolalms/video: ^0
- escolalms/webinar: ^0
- escolalms/youtube: ^0
- nunomaduro/larastan: ^2.0
- orchestra/testbench: >=5.0
- phpunit/phpunit: ^9.0
Suggests
- escolalms/auth: ^0.1.54
- escolalms/consultations: ^0
- escolalms/courses: ^0.3.8
- escolalms/settings: ^0.1.2
- escolalms/webinar: ^0
- dev-main
- 0.1.67
- 0.1.66
- 0.1.65
- 0.1.64
- 0.1.63
- 0.1.62
- 0.1.61
- 0.1.60
- 0.1.59
- 0.1.58
- 0.1.57
- 0.1.56
- 0.1.55
- 0.1.54
- 0.1.53
- 0.1.52
- 0.1.51
- 0.1.50
- 0.1.49
- 0.1.48
- 0.1.47
- 0.1.46
- 0.1.45
- 0.1.44
- 0.1.43
- 0.1.42
- 0.1.41
- 0.1.40
- 0.1.39
- 0.1.38
- 0.1.37
- 0.1.36
- 0.1.35
- 0.1.34
- 0.1.33
- 0.1.32
- 0.1.31
- 0.1.30
- 0.1.29
- 0.1.28
- 0.1.27
- 0.1.26
- 0.1.25
- 0.1.24
- 0.1.23
- 0.1.22
- 0.1.21
- 0.1.20
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-feature/REK-38
- dev-feature/admin-readme
- dev-feature/php82
- dev-feature/readme
This package is auto-updated.
Last update: 2024-11-12 10:34:43 UTC
README
Package for email notifications with editable templates (for important user-related events)
Purpose
This package allows you to create email notifications for events emitted in Laravel app.
Each notification is created as a class describing available variables that can be used in Template (which will be created in database and editable through admin panel). This class must be registered using Template facade from Template package, where you specify which Event it is associated with and which Channel it is sent through (e.g. Email channel when defined in this package).
Installing
composer require escolalms/templates-email
php artisan db:migrate
php artisan db:seed --class="EscolaLms\TemplatesEmail\Database\Seeders\TemplatesEmailSeeder"
Dependencies
Usage
Defining Templates
- Create event which triggers sending email using specified template. This event must implement method getUser() returning User model from LMS Core package.
- Create Class defining template variables, which you will use in email notification,
- Associate your class describing template variables with event and channel through which notifications should be sent. Use
EscolaLms\Templates\Facades\Template::register(Event class, EscolaLms\TemplatesEmail\Core\EmailChannel::class, Variable class);
- Register template in db for admin panel or used
/api/admin/templates
, better described in Template package
Mjml (pre)rendering
- Emails are written using MJML, which then is prerendered into HTML when saving a Template (so that sending an email does not call renderer for each message).
- To render MJML you need to either:
- install
mjml
npm package and configure path to executable binary in this package configbinary_path
key - register to MJML API and configure api id & secret in this package config file
- install
Tests
Run ./vendor/bin/phpunit --filter 'EscolaLms\\TemplatesEmail\\Tests'
to run tests. See tests folder as it contains a basic implementation of Variable (or Template description) class with minimal customisation - a quite good starting point for creating your own.
Permissions
No Permissions defined for this package.