Groundmail with PHP
Use the PHP SDK in Laravel, Symfony, WordPress plugins, or any server-side PHP app where your API key can stay private.
1. Install the SDK
composer require groundmail/groundmail2. Configure your API key
export GROUNDMAIL_API_KEY=gm_your_key_here3. Send an email
<?php
use Groundmail\Client;
$tx = new Client(getenv('GROUNDMAIL_API_KEY'));
$result = $tx->emails->send([
'from' => 'ops@yourdomain.com',
'to' => 'user@example.com',
'subject' => 'Your receipt',
'html' => '<p>Thanks for your purchase.</p>',
]);
echo $result['id'], ' ', $result['status'], PHP_EOL;Resources
The client includes thin wrappers for common API resources:
$tx->emails— send, batch, list, cancel, resend, test webhooks, deliverability insights$tx->domains— create, verify, apply DNS, update, delete$tx->webhooks— CRUD for webhook endpoints$tx->templates— CRUD plus publish$tx->suppressions— list, create, remove
See the API reference for request fields. The PHP SDK accepts the same JSON shapes as the REST API.
For Symfony Mailer, use groundmail/symfony-mailer. For Laravel, use groundmail/laravel (config, container binding, Facade — built on the Symfony transport).
Source
Package source lives in Groundmail/groundmail-php (Packagist requires composer.json at repo root).