1
1
# Tatter\Outbox
2
2
Email toolkit for CodeIgniter 4
3
3
4
- [ ![ ] ( https://github.com/tattersoftware/codeigniter4-outbox/workflows/PHPUnit/badge.svg )] ( https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/test .yml )
5
- [ ![ ] ( https://github.com/tattersoftware/codeigniter4-outbox/workflows/PHPStan/badge.svg )] ( https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/analyze .yml )
6
- [ ![ ] ( https://github.com/tattersoftware/codeigniter4-outbox/workflows/Deptrac/badge.svg )] ( https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/inspect .yml )
4
+ [ ![ ] ( https://github.com/tattersoftware/codeigniter4-outbox/workflows/PHPUnit/badge.svg )] ( https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/phpunit .yml )
5
+ [ ![ ] ( https://github.com/tattersoftware/codeigniter4-outbox/workflows/PHPStan/badge.svg )] ( https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/phpstan .yml )
6
+ [ ![ ] ( https://github.com/tattersoftware/codeigniter4-outbox/workflows/Deptrac/badge.svg )] ( https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/deptrac .yml )
7
7
[ ![ Coverage Status] ( https://coveralls.io/repos/github/tattersoftware/codeigniter4-outbox/badge.svg?branch=develop )] ( https://coveralls.io/github/tattersoftware/codeigniter4-outbox?branch=develop )
8
8
9
9
## Quick Start
10
10
11
11
1 . Install with Composer: ` > composer require tatter/outbox `
12
12
2 . Prepare the database: ` > php spark migrate -all && php spark db:seed "Tatter\Outbox\Database\Seeds\TemplateSeeder" `
13
13
3 . Send beautiful, dynamic email:
14
- ```
14
+ ``` php
15
15
model(TemplateModel::class)->findByName('Default')
16
16
->email([
17
17
'item' => 'Fancy Purse',
@@ -31,7 +31,7 @@ logging, style inlining, and templating.
31
31
32
32
Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities
33
33
and always be up-to-date:
34
- ``` bash
34
+ ``` shell
35
35
composer require tatter/outbox
36
36
```
37
37
@@ -44,7 +44,7 @@ The library's default behavior can be altered by extending its config file. Copy
44
44
** examples/Outbox.php** to ** app/Config/** and follow the instructions
45
45
in the comments. If no config file is found in ** app/Config** then the library will use its own.
46
46
47
- If you plan to use the Template Routes (see below) you should also want to configure
47
+ If you plan to use the Template Routes (see below) you might also want to configure
48
48
[ Tatter\Layouts] ( https://github.com/tattersoftware/codeigniter4-layouts ) to ensure the
49
49
views are displayed properly for your app.
50
50
@@ -73,14 +73,15 @@ supply your own as string parameters, or create a View file and add it to the co
73
73
[ Responsive HTML Email Template] ( https://github.com/leemunroe/responsive-html-email-template ) .
74
74
This provides a solid basis for your emails so you can be sure they will display nicely on
75
75
any device. Run the Template Seeder to begin using this as the default:
76
-
76
+ ``` shell
77
77
php spark db:seed " Tatter\Outbox\Database\Seeds\TemplateSeeder"
78
+ ```
78
79
79
80
You may also write your own templates and seed them or use the provided MVC bundle for
80
81
managing email templates in your database. To enable the Controller you will need to
81
82
toggle ` $routeTemplates ` in the configuration, or add the following routes to ** app/Config/Routes.php** :
82
83
83
- ```
84
+ ``` php
84
85
// Routes to Email Templates
85
86
$routes->group('emails', ['namespace' => '\Tatter\Outbox\Controllers'], function ($routes)
86
87
{
@@ -98,7 +99,7 @@ Be sure to secure appropriate access to these routes (e.g. with a Filter).
98
99
Templates use View Parser "tokens" that will be passed through to add your data.
99
100
The ` Template ` Entity can do this for you by passing in your data parameters:
100
101
101
- ```
102
+ ``` php
102
103
$template = model(TemplateModel::class)->findByName('Item Purchase');
103
104
104
105
$subject = $template->renderSubject(['item' => 'Fancy Purse']);
@@ -110,7 +111,7 @@ template in its parent (if defined).
110
111
111
112
If you do not need any other configuration you can get a fully prepared
112
113
version of the ` Email ` class with rendered and inlined content from the library:
113
- ```
114
+ ``` php
114
115
$email = $template->email($data);
115
116
$email->setTo('
[email protected] ')->send();
116
117
```
0 commit comments