PHP code example of zeevx / laravel-sendbyte-transport

1. Go to this page and download the library: Download zeevx/laravel-sendbyte-transport 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/ */

    

zeevx / laravel-sendbyte-transport example snippets


'mailers' => [
    // ...
    'sendbyte' => [
        'transport' => 'sendbyte',
        'key' => env('SENDBYTE_API_KEY'),
    ],
],

'sendbyte' => [
    'key' => env('SENDBYTE_API_KEY'),
],

'sendbyte' => [
    'transport' => 'sendbyte',
    'key' => env('SENDBYTE_API_KEY'),
    'base_url' => env('SENDBYTE_BASE_URL', 'https://api.sendbyte.africa'),
    'timeout' => 30,
],

'sendbyte' => [
    'transport' => 'sendbyte',
    'key' => env('SENDBYTE_API_KEY'),
    'from' => [
        'address' => env('SENDBYTE_FROM_ADDRESS', env('MAIL_FROM_ADDRESS')),
        'name' => env('SENDBYTE_FROM_NAME', env('MAIL_FROM_NAME')),
    ],
],

Mail::to($user)->send(new OrderShipped($order));

$user->notify(new InvoicePaid($invoice));

use Illuminate\Mail\Mailables\Envelope;

public function envelope(): Envelope
{
    return new Envelope(
        subject: 'Your receipt',
        tags: ['receipt', 'payment'],
    );
}

public function headers(): Headers
{
    return new Headers(text: [
        'X-SendByte-Idempotency-Key' => 'order-4421-receipt',
    ]);
}

$sent = Mail::to($user)->send(new OrderShipped($order));

$sent->getMessageId(); // "em_01j..."