Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Mailcoach Sdk Php

Mailcoach Sdk Php Laravel Package

spatie/mailcoach-sdk-php

PHP SDK for the Mailcoach API (self-hosted v6+ and Mailcoach Cloud). Manage email lists, subscribers, and campaigns: create and send campaigns, send tests, and browse paginated resources with an easy next() workflow.

View on GitHub
Deep Wiki
Context7

An SDK for using the Mailcoach API in PHP

Frequently asked questions about Mailcoach Sdk Php
How do I install the Mailcoach SDK in a Laravel project?
Use Composer to install the package with `composer require spatie/mailcoach-sdk-php`. Then configure your API key and endpoint in `config/services.php` or `.env` (e.g., `MAILCOACH_API_KEY=your_key`). Register the SDK as a singleton in `AppServiceProvider` for dependency injection.
Does this SDK support both self-hosted Mailcoach and Mailcoach Cloud?
Yes, the SDK works with both self-hosted Mailcoach (v6+) and Mailcoach Cloud. Just specify the correct API endpoint in your configuration. The same codebase handles both environments seamlessly.
Can I use this SDK to send transactional emails alongside marketing campaigns?
Yes, the SDK supports transactional emails (added in v1.9.0+). You can integrate it with Laravel’s Mail facade for hybrid workflows, though Mailcoach’s primary focus remains marketing campaigns like newsletters.
How does pagination work with the SDK, and can I customize the page size?
The SDK uses Mailcoach’s default pagination (1000 items/page) but provides a `next()` method to iterate through results. You can’t directly customize the page size via the SDK, but Mailcoach’s API allows adjusting this on the server side if needed.
Is there built-in support for Laravel’s queue system to handle async operations?
Yes, offload async operations like sending campaigns to Laravel’s queue by wrapping SDK calls in queueable jobs. This improves performance for high-volume tasks and avoids timeouts.
How do I handle API rate limits in Laravel with this SDK?
The SDK includes rate-limit exceptions (v1.9.1+). Pair it with `spatie/laravel-queueable-rate-limiting` to implement retries for throttled requests. Monitor Mailcoach’s API limits and adjust Laravel’s queue workers accordingly.
Can I sync Mailcoach subscribers with Laravel Eloquent models (e.g., Users)?
Yes, use Eloquent observers or Laravel’s Model events to sync data. For example, trigger a Mailcoach subscriber update when a User model is created or updated. The SDK’s resource objects (e.g., `Subscriber`) map cleanly to Eloquent attributes.
What Laravel versions and PHP versions are supported by this SDK?
The SDK requires PHP 8.0+ and is compatible with Laravel 8+. Check the [GitHub repo](https://github.com/spatie/mailcoach-sdk-php) for the latest version’s specific requirements, as dependencies like Guzzle may have version constraints.
Are there alternatives to this SDK for Laravel Mailcoach integrations?
For basic API interactions, you could use Guzzle directly or Mailcoach’s official API docs. However, this SDK provides Laravel-specific conveniences like pagination helpers, event-driven automations, and seamless integration with Laravel’s service container, saving development time.
How do I test Mailcoach campaigns locally before sending to subscribers?
Use the `sendTest()` method on a campaign object to send test emails to specific addresses (e.g., `$campaign->sendTest('test@example.com')`). For Laravel-specific testing, mock the SDK’s HTTP client or use Mailcoach’s sandbox environment if available.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony