PHP code example of tatter / outbox

1. Go to this page and download the library: Download tatter/outbox library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tatter / outbox example snippets


model(TemplateModel::class)->findByName('Default')
	->email([
		'item' => 'Fancy Purse',
		'cost' => '10 dollars',
		'url'  => site_url('items/show/' . $itemId),
	])
	->setTo($user->email)
	->send();

// Routes to Email Templates
$routes->group('emails', ['namespace' => '\Tatter\Outbox\Controllers'], function ($routes)
{
	$routes->get('templates/new/(:segment)', 'Templates::new/$1');
	$routes->get('templates/send/(:segment)', 'Templates::send/$1');
	$routes->post('templates/send/(:segment)', 'Templates::send_commit/$1');
	$routes->presenter('templates', ['controller' => 'Templates']);
});

$template = model(TemplateModel::class)->findByName('Item Purchase');

$subject = $template->renderSubject(['item' => 'Fancy Purse']);
$body    = $template->renderBody(['cost' => '10 dollars']);

$email = $template->email($data);
$email->setTo('[email protected]')->send();
shell
	php spark db:seed "Tatter\Outbox\Database\Seeds\TemplateSeeder"