PHP code example of daylaborers / laravel-mjml

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

    

daylaborers / laravel-mjml example snippets


<mjml>
    <mj-body>
        <mj-section>
            <mj-column>
                <mj-text font-size="20px" color="#F45E43">{{ $verificationUrl }}</mj-text>
            </mj-column>
        </mj-section>
    </mj-body>
</mjml>

<mjml>
    <mj-body>
        <mj-section>
            <mj-column>
                <mj-raw>@if (true)</mj-raw>
                <mj-text font-size="20px" color="#F45E43">{{ $someVariable }}</mj-text>
                <mj-raw>@endif</mj-raw>
            </mj-column>
        </mj-section>
    </mj-body>
</mjml>

use DayLaborers\LaravelMjml\Mail\MjmlMailable;

class VerifyEmail extends MjmlMailable
{
    /**
     * @param string $verificationUrl
     */
    public function __construct(protected string $verificationUrl)
    {
        //
    }
    
    /**
     * @return Content
     */
    public function content(): Content
    {
        return new Content(
            view: 'emails.notifications.verify',
            with: [
                'verificationUrl' => $this->verificationUrl
            ]
        );
    }
}