Integrations / Laravel
Sendersy + Laravel
Laravel + Sendersy: configure via config/services.php and send via GuzzleHttp.
1. Install
bash
composer require guzzlehttp/guzzle
2. Environment variables
bash
SENDERSY_API_KEY=sk_live_...
3. Send an email
php
<?php
// app/Services/SendersyMailer.php
namespace App\Services;
use GuzzleHttp\Client;
class SendersyMailer
{
private Client $http;
public function __construct()
{
$this->http = new Client([
'base_uri' => 'https://api.sendersy.com/v1/',
'headers' => [
'Authorization' => 'Bearer ' . env('SENDERSY_API_KEY'),
'Content-Type' => 'application/json',
],
]);
}
public function sendWelcome(string $email, string $name): array
{
$resp = $this->http->post('emails', [
'json' => [
'from' => 'Sendersy <noreply@yourcompany.com>',
'to' => [$email],
'subject' => "Welcome, {$name}!",
'html' => "<p>Thanks for signing up, <strong>{$name}</strong>!</p>",
],
]);
return json_decode((string) $resp->getBody(), true);
}
}