PHP code example of seinoxygen / laravel-elastic-email

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

    

seinoxygen / laravel-elastic-email example snippets


'elastic_email' => [
	'key' => env('ELASTIC_KEY'),
	'account' => env('ELASTIC_ACCOUNT')
]

'elastic_email' => [
	'transport' => 'elasticemail'
]

'providers' => [
    ...
    SeinOxygen\ElasticEmail\MailServiceProvider::class,
    SeinOxygen\ElasticEmail\ApiServiceProvider::class,
    ...
],

'aliases' => [
    ...
    'ElasticEmail' => SeinOxygen\ElasticEmail\Facades\ElasticEmail::class,
    ...
],

public function build()
{
    // You can set ad many models you want to relate with the outgoing email
    $models = [
        [$yourmodel->id, get_class($yourmodel)],
    ];

    return $this
        ->subject("My Subject")
        ->view('my-view')
        ->with([
            'models' => $models
        ]);
}



namespace app\Listeners;

use SeinOxygen\ElasticEmail\Events\WebhookCallReceived;

class WebhookCallListerner
{
    public function handle(WebhookCallReceived $event)
    {
        $request = $event->request;
    }
}


    //For contact
    ElasticEmail::Contact()

    //For emails
    ElasticEmail::Email()

bash
php artisan vendor:publish --provider="SeinOxygen\ElasticEmail\ApiServiceProvider" --tag="migrations"
bash
php artisan migrate
bash
php artisan vendor:publish --provider="SeinOxygen\ElasticEmail\ApiServiceProvider" --tag="config"