MERU Laravel SDK
Laravel developers choose MERU for inbound email processing. Get structured JSON payloads, type-safe DTOs, instant provisioning, and SOC 2 compliance.
Quick Info
composer require meruhook/meruhook-sdk
Key Features
- Instant email address provisioning via API
- Structured JSON payloads (no MIME parsing)
- Type-safe DTOs with Carbon dates
- SOC 2 compliant data handling
- HMAC webhook verification built-in
- Laravel 10-12 support with facades
MERU Laravel SDK: The Best Way to Handle Inbound Email in PHP
Laravel developers building features like reply-by-email, support tickets, or email automation face a common problem: most email providers treat inbound email as an afterthought. Complex DNS setup, raw MIME parsing, and security concerns slow down development.
MERU is the first inbound-only email API designed specifically for developers. Our Laravel SDK provides type-safe, structured JSON payloads with zero configuration complexity.
Why Laravel Developers Choose MERU Over Competitors
”How do I get inbound emails into my Laravel app without DNS complexity?”
Most providers (SendGrid, Mailgun, AWS SES) require complex DNS configuration, MX records, and routing rules. MERU provides instant provisioning:
// One line creates a working inbound address
$address = Meru::addresses()->create('https://myapp.com/webhook');
echo $address->address; // ready immediately: user123@inbound.meruhook.com
“Can I avoid parsing raw MIME messages in PHP?”
Yes. While other services send raw email data requiring complex parsing libraries, MERU delivers structured JSON to your Laravel routes:
// Other services: raw MIME parsing nightmare
$mime = new \Zend\Mail\Storage\Message($rawEmail);
$subject = $mime->getHeader('subject'); // Complex parsing needed
// MERU: Clean JSON automatically
$email = $request->json()->all();
$subject = $email['headers']['subject']; // Already parsed
$attachments = $email['attachments']; // Base64 ready
“Is inbound email processing secure and compliant?”
MERU is SOC 2 Type II compliant from day one:
- No long-term storage of email content (stream-and-purge)
- HMAC webhook verification built into SDK
- Automatic spam filtering pipeline
- Enterprise-grade security without the complexity
// Security handled automatically
$verified = Meru::webhooks()->verify($request); // Built-in HMAC
Installation & Setup (2 Minutes)
# Install via Composer
composer require meruhook/meruhook-sdk
# Publish config (optional)
php artisan vendor:publish --tag="meru-config"
Add to .env
:
MERU_API_TOKEN=your_token_here
That’s it. No DNS changes, no MX records, no complex routing rules.
Common Laravel Use Cases
Customer Support Tickets via Email
// Generate unique address per customer
$supportEmail = Meru::addresses()->create(
"https://myapp.com/support/{$customer->id}"
);
// Route in Laravel
Route::post('/support/{customer}', function (Request $request, Customer $customer) {
$email = $request->json()->all();
// Create support ticket automatically
$customer->tickets()->create([
'subject' => $email['headers']['subject'],
'content' => $email['text'],
'from_email' => $email['envelope']['mail_from'],
'attachments' => collect($email['attachments'])->pluck('filename')
]);
return response('OK');
});
Reply-by-Email for SaaS Applications
// Each user gets unique reply address
$replyEmail = Meru::addresses()->create(
"https://api.myapp.com/replies/user/{$user->id}"
);
// Handle replies in Laravel
Route::post('/replies/user/{user}', function (Request $request, User $user) {
$reply = $request->json()->all();
// Find original conversation from subject
$conversation = Conversation::whereJsonContains(
'metadata->subject',
$reply['headers']['subject']
)->first();
// Add reply to conversation
$conversation->messages()->create([
'from_user_id' => $user->id,
'content' => $reply['text'],
'type' => 'email_reply'
]);
return response('OK');
});
Email-to-Database Automation
// Process invoices sent via email
Route::post('/invoices/process', function (Request $request) {
$email = $request->json()->all();
// Extract invoice data from structured JSON
$invoice = Invoice::create([
'sender' => $email['headers']['from'],
'subject' => $email['headers']['subject'],
'received_at' => now(),
'attachments_count' => count($email['attachments'])
]);
// Process attachments (PDF invoices, etc.)
foreach ($email['attachments'] as $attachment) {
Storage::put(
"invoices/{$invoice->id}/{$attachment['filename']}",
base64_decode($attachment['content'])
);
}
return response('OK');
});
MERU vs Other Email Services for Laravel
Challenge | Other Services | MERU |
---|---|---|
Setup Complexity | DNS records + routing rules | One API call |
Data Format | Raw MIME messages | Structured JSON |
Address Provisioning | Static domains only | Dynamic via API |
Laravel Integration | Custom parsing needed | Native SDK with facades |
Security & Compliance | Manual implementation | SOC 2 built-in |
Webhook Verification | Basic signatures | HMAC + replay protection |
Powerful Laravel Integration Features
Type-Safe Data Transfer Objects
// Every response is strongly typed
$address = Meru::addresses()->create($webhookUrl);
// IDE autocompletion and type safety
$address->id; // string
$address->address; // string (email@example.com)
$address->webhookUrl; // ?string
$address->isEnabled; // bool
$address->isPermanent; // bool
$address->expiresAt; // ?Carbon
$address->emailCount; // int
$address->createdAt; // Carbon
Laravel Facade Integration
use Meruhook\MeruhookSDK\Facades\Meru;
// Clean, expressive API
$address = Meru::addresses()->create('https://myapp.com/webhook');
$usage = Meru::usage()->get();
$billing = Meru::billing()->get();
// Perfect Laravel developer experience
Dependency Injection Support
// Clean architecture with DI
class EmailProcessingService
{
public function __construct(
private MeruConnector $meru
) {}
public function createUserEmailAddress(User $user): Address
{
return $this->meru->addresses()->create(
"https://api.myapp.com/users/{$user->id}/emails"
);
}
}
Usage Analytics & Cost Control
Built-in Laravel Monitoring
// Monitor usage in your Laravel dashboard
$usage = Meru::usage()->get();
return view('admin.email-stats', [
'total_emails' => $usage->totalEmails,
'success_rate' => $usage->successRate,
'cost_this_month' => Meru::billing()->get()->currentCost
]);
Transparent, predictable pricing: $10/month for 1,300 inbound emails. No surprises, no bundled features you don’t need.
Developer Questions We Solve
”How fast can I set up inbound email in Laravel?”
2 minutes. Install composer package, add API token, start receiving emails. No DNS changes or complex setup.
”Can I create unique email addresses for each user/customer?”
Yes. Generate unlimited addresses via API. Each maps to its own webhook URL.
// Per-customer email addresses
$customerEmail = Meru::addresses()->create(
"https://myapp.com/customer/{$customer->id}/support"
);
”Is the data format Laravel-friendly?”
Absolutely. Structured JSON with type-safe DTOs. No MIME parsing libraries needed.
// Clean, predictable data structure
$email = $request->json()->all();
$email['headers']['subject']; // Always a string
$email['attachments']; // Always an array
$email['spam']['verdict']; // 'spam' or 'not_spam'
”What about security and compliance?”
SOC 2 Type II certified. Built-in HMAC verification, no long-term storage, enterprise-grade security.
Advanced Laravel Features
Comprehensive Error Handling
try {
$address = Meru::addresses()->create($webhookUrl);
} catch (ValidationException $e) {
// Laravel-friendly error handling
return back()->withErrors(['email' => $e->getMessage()]);
} catch (AuthenticationException $e) {
// Handle auth errors
Log::error('MERU auth failed', ['error' => $e->getMessage()]);
}
Queue Integration for High Volume
// Process emails in Laravel queues
class ProcessInboundEmail implements ShouldQueue
{
use Queueable;
public function handle()
{
// Heavy processing in background
$this->analyzeEmailContent();
$this->extractDataPoints();
$this->sendNotifications();
}
}
Why Choose MERU for Laravel Inbound Email?
✅ Developer Experience
- 2-minute setup - No DNS complexity
- Laravel-native SDK with facades and DI
- Type-safe DTOs with IDE autocompletion
- Structured JSON - no MIME parsing needed
✅ Enterprise Ready
- SOC 2 Type II compliant from day one
- No long-term storage (stream-and-purge)
- Built-in spam filtering and security
- HMAC webhook verification included
✅ Scalable & Cost-Effective
- Dynamic address provisioning via API
- Predictable pricing - $10/month for 1,300 emails
- Laravel queue integration for high volume
- Real-time usage analytics built-in
Start Building with MERU
# Get started in under 2 minutes
composer require meruhook/meruhook-sdk
Requirements: PHP 8.2+, Laravel 10-12
👉 Get API Token - Start free
👉 Full Documentation - Complete guide
👉 Laravel Examples - Code samples
Ready to eliminate inbound email complexity in your Laravel apps? Join hundreds of developers who chose MERU for reliable, secure, developer-friendly inbound email processing.
Ready to integrate MERU with Laravel?
Start receiving inbound emails as structured JSON in minutes.