Skip to content
laranailPublic

About

Responsive, un-styled Blade email components and a fluent mail builder for Laravel.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

32 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laranail/barua

Tests Static analysis License: MIT

laranail/barua is not on Packagist, so there is no registry-version badge to show; Install covers the VCS route.

Responsive, un-styled Blade email components and a fluent mail builder for Laravel.

Targets PHP ^8.4.1 || ^8.5 on Laravel ^13.0. Built on laranail/package-tools.

Install

Add the VCS repositories (the laranail family does not resolve through Packagist), then require the package:

"repositories": [
    { "type": "vcs", "url": "https://github.com/laranail/barua" },
    { "type": "vcs", "url": "https://github.com/laranail/package-tools" }
]
composer require laranail/barua
<x-laranail-barua::text>Hello from barua.</x-laranail-barua::text>

Quick start guide and usage

Getting started

  1. Nothing to register: the service provider is discovered automatically.

  2. barua sends through your application's own mail configuration, so set the mailer and MAIL_FROM_ADDRESS / MAIL_FROM_NAME in .env as you would for any Laravel mail.

  3. Optionally, publish the config to change a default:

    php artisan vendor:publish --tag=laranail::barua-config

Usage

{{-- resources/views/emails/receipt.blade.php --}}
<x-laranail-barua::html lang="en">
    <x-laranail-barua::body style="background-color: #f6f9fc;">
        <x-laranail-barua::container style="background-color: #ffffff; padding: 32px;">
            <x-laranail-barua::heading as="h1" mb="16">Thanks, {{ $name }}</x-laranail-barua::heading>
            <x-laranail-barua::text>Your order {{ $orderId }} is on its way.</x-laranail-barua::text>
            <x-laranail-barua::link href="{{ $trackingUrl }}">Track it</x-laranail-barua::link>
        </x-laranail-barua::container>
    </x-laranail-barua::body>
</x-laranail-barua::html>

Send one of the bundled messages with the builders and MailSender:

use Simtabi\Laranail\Barua\Builders\DataBuilder;
use Simtabi\Laranail\Barua\Builders\ErrorBuilder;
use Simtabi\Laranail\Barua\Builders\MailBuilder;
use Simtabi\Laranail\Barua\Mail\Messages\Onboarding\WelcomeUser;
use Simtabi\Laranail\Barua\Services\MailSender;

$errors  = new ErrorBuilder();
$data    = (new DataBuilder())->setData(['name' => $user->name, 'companyName' => 'Acme', 'verification_link' => $verificationUrl]);
$builder = (new MailBuilder(errorBuilder: $errors))->setTo($user->email, $user->name);
$mail    = new WelcomeUser(mailBuilder: $builder, dataBuilder: $data, errorBuilder: $errors);

(new MailSender(mailable: $mail, mailBuilder: $builder, dataBuilder: $data, errorBuilder: $errors))
    ->sendEmail(queued: true);

The full walkthrough is in Getting started; everything else is in the documentation index.

Documentation

Full documentation is at opensource.simtabi.com/documentation/laranail/barua.

Guides

Reference

Recipes

Contributing & security

Issues and PRs are welcome; see CONTRIBUTING.md. Report vulnerabilities privately per SECURITY.md. Participation follows the laranail Code of Conduct.

License

MIT © Simtabi LLC. See LICENSE.

About

Responsive, un-styled Blade email components and a fluent mail builder for Laravel.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages