Ranla with Laravel
Use the Laravel package for a first-class Mail transport (MAIL_MAILER=supersendtx), plus a service container binding and Facade on top of the PHP SDK.
1. Install the package
composer require supersendtx/laravelThis also installs supersendtx/supersendtx (HTTP client) and supersendtx/symfony-mailer (Symfony Mailer transport used by Laravel’s mailer).
2. Configure env
Publish package config (optional):
php artisan vendor:publish --tag=supersendtx-configAdd to .env:
RANLA_API_KEY=rnl_your_key_here
MAIL_MAILER=supersendtx
# optional override:
# SUPERSENDTX_BASE_URL=https://api.ranla.ai3. Register the mailer
In config/mail.php, add a mailer that uses the supersendtx transport:
'mailers' => [
// ...
'@supersend/ranla' => [
'transport' => '@supersend/ranla',
],
],With MAIL_MAILER=supersendtx, every Mailable, Notification, and queued mail routes through Ranla. No send-call rewrites.
4. Send with Mailables (recommended)
use Illuminate\Support\Facades\Mail;
use App\Mail\WelcomeMail;
Mail::to($user)->send(new WelcomeMail($user));Tags, idempotency, and schedule
Set Ranla headers on the Symfony message (for example in a Mailable headers() method or withSymfonyMessage):
use Illuminate\Mail\Mailables\Headers;
use SuperSendTX\Laravel\Transport\MessageMapper;
public function headers(): Headers
{
return new Headers(
text: [
MessageMapper::HEADER_TAG => 'campaign=welcome',
MessageMapper::HEADER_IDEMPOTENCY => 'welcome-'.$this->user->id,
// MessageMapper::HEADER_SCHEDULED_AT => '2030-01-01T00:00:00Z',
],
);
}X-SuperSendTX-Tag uses name=value. Repeat the header for multiple tags. Custom non-reserved headers are forwarded to the API headers field.
5. Send via the Facade (API client)
When you need the REST client directly (batch, domains, webhooks):
use SuperSendTX\Laravel\Facades\SuperSendTX;
$result = SuperSendTX::client()->emails->send([
'from' => '[email protected]',
'to' => '[email protected]',
'subject' => 'Your receipt',
'html' => '<p>Thanks for your purchase.</p>',
]);Or resolve the client from the container:
use Ranla\Client;
public function __construct(private Client $supersendtx)
{
}
$this->supersendtx->emails->send([...]);Plain PHP without Laravel
If you don't need the service provider, Mail transport, or Facade, use the PHP SDK directly:
composer require ranla/ranlaSee PHP SDK.
Source
Package source lives in Super-Send/supersendtx-laravel (Packagist requires composer.json at repo root).