zero-bounce/sdk
Framework-agnostic PHP SDK for the ZeroBounce email validation API. Install via Composer, initialize with your API key, and call endpoints like getCredits. Supports base URL selection (Default/USA/EU) and works smoothly in Laravel apps.
Pros:
ZBException for API failures, which can be extended to Laravel’s exception handling (e.g., Handler class).ZBBaseUrl enum, critical for GDPR/CCPA compliance.Cons:
.env or Vault) and rotation logic.getCredits() method enables programmatic monitoring, but Laravel-level throttling (e.g., via throttle middleware) may still be needed.sendFile) are async. Laravel’s queues can wrap these calls for background processing, but the SDK lacks native queue integration.composer.json to avoid breaking changes.ZBException helps, but custom error handling in Laravel (e.g., logging, retries) is recommended.Storage facade) is configured for these paths.Scalability Needs:
Compliance:
ZBBaseUrl enum be extended?Monitoring:
Testing:
Maintenance:
ZeroBounceServiceProvider).ZeroBounce facade to simplify usage (e.g., ZeroBounce::validate($email)).sendFile) in Laravel jobs for async processing.Storage facade to handle file uploads/downloads for bulk operations.Laravel 10.x
PHP 8.1+
ZeroBounce SDK v2.1.8
Guzzle HTTP Client (if extending SDK for custom requests)
Redis (for caching validation results)
Laravel Queues (for bulk operations)
Phase 1: Core Integration (1–2 weeks)
ZeroBounceServiceProvider to bind the SDK to Laravel’s container:
$this->app->singleton(ZeroBounce::class, function ($app) {
$apiKey = config('services.zerobounce.key');
$baseUrl = config('services.zerobounce.url', ZBBaseUrl::API_DEFAULT_URL);
$sdk = ZeroBounce::Instance();
$sdk->initialize($apiKey, $baseUrl);
return $sdk;
});
config/services/zerobounce.php) for API key and endpoint settings.Facade::register('ZeroBounce', ZeroBounceFacade::class);
Phase 2: Real-Time Validation (1 week)
validate() and validateBatch() into user signup flows (e.g., Form Requests or Observers).ZBException (e.g., log errors, notify admins).Phase 3: Async Bulk Processing (2 weeks)
ValidateBulkEmailsJob):
public function handle() {
$response = ZeroBounce::validateBatch($this->emails);
// Store results in DB/queue notifications
}
FileStatusCheckerJob to poll fileStatus() until completion.Phase 4: Advanced Features (1–2 weeks)
findEmail) into lead enrichment workflows.getCredits() and getApiUsage().| Priority | Task | Dependencies |
|---|---|---|
| 1 | Install SDK and configure Laravel service provider/facade. | Composer, Laravel container. |
| 2 | Implement real-time validation in signup flows. | Phase 1, caching (optional). |
| 3 | Set up async bulk processing with queues. | Phase 1, Laravel queues. |
| 4 | Add monitoring for credits/usage. | Phase 1, Laravel logging/dashboards. |
| 5 | Extend for email finding/scoring APIs. | Phase 1, business requirements. |
Proactive Measures:
composer.json to avoid unexpected updates.guessFormat → findEmailFormat).Mockery or PHPUnit.ZBException scenarios.Ongoing Tasks:
getCredits() daily and alert admins when below a threshold.How can I help you explore Laravel packages today?