PHP code example of it-devgroup / laravel-email-template-lite

1. Go to this page and download the library: Download it-devgroup/laravel-email-template-lite 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/ */

    

it-devgroup / laravel-email-template-lite example snippets


php artisan email:template:publish --tag=config

php artisan email:template:publish --tag=migration

php artisan migrate

php artisan email:template:publish --tag=resource

        \ItDevgroup\LaravelEmailTemplateLite\Providers\EmailTemplateServiceProvider::class,

    'providers' => [
        ...
        \ItDevgroup\LaravelEmailTemplateLite\Providers\EmailTemplateServiceProvider::class,
    ]

php artisan vendor:publish --provider="ItDevgroup\LaravelEmailTemplateLite\Providers\EmailTemplateServiceProvider" --tag=config

php artisan email:template:publish --tag=migration

php artisan migrate

php artisan vendor:publish --provider="ItDevgroup\LaravelEmailTemplateLite\Providers\EmailTemplateServiceProvider" --tag=resources

php artisan email:template:sync



namespace App;

class CustomFile extends \ItDevgroup\LaravelEmailTemplateLite\Model\EmailTemplate
{
}



namespace App;

class CustomFile extends \ItDevgroup\LaravelEmailTemplateLite\Model\EmailTemplate
{
    protected $table = 'YOUR_TABLE_NAME';
    
    // other code
}

$lengthAwarePaginator = $service->getList(null, $page, $perPage);
$lengthAwarePaginator = $service->getList(null, 1, 10);

$emailTemplate = $service->getById(1);
// or
$emailTemplate = $service->getByType('type');
$service->render($emailTemplate, ['test_1' => '111', 'test_2' => 222]);
return $emailTemplate;

php artisan email:template:sync



namespace App;

use ItDevgroup\LaravelEmailTemplateLite\EmailTemplateVariableInterface;

class CustomEmailTemplateVariableSiteName implements EmailTemplateVariableInterface
{
    public function toString(): ?string
    {
        return 'site name';
    }
}