PHP code example of onix-systems-php / hyperf-mailer

1. Go to this page and download the library: Download onix-systems-php/hyperf-mailer 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/ */

    

onix-systems-php / hyperf-mailer example snippets

 

declare(strict_types=1);

namespace App\Mail\Users;

use OnixSystemsPHP\HyperfMailer\Contract\ShouldQueue;
use OnixSystemsPHP\HyperfMailer\Mailable;

class TestEmail extends Mailable implements ShouldQueue
{
    public function __construct(private string $name)
    {
    }

    public function build(): void
    {
        $this
            ->subject('PHP Department welcome')
            ->textBody(sprintf('Hello, %s!', $this->name));
    }
}

...

$this->emailService->run(
    new User([
        'email' => $recipient[0],
        'first_name' => $recipient[1],
    ]),
    new TestEmail($recipient[1])
);
shell script
composer 
shell script
php bin/hyperf.php vendor:publish onix-systems-php/hyperf-mailer