skaisser / larasendy
A Laravel package to integrate Sendy.co for email subscriptions automatically to all your Laravel installations
v1.2.4
2024-11-27 06:09 UTC
Requires
- php: ^7.3|^8.0
- guzzlehttp/guzzle: ^6.3|^7.0
- illuminate/support: ^6.0|^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- doctrine/dbal: ^3.9
- mockery/mockery: ^1.4
- orchestra/testbench: ^6.0|^7.0|^8.0
- phpunit/phpunit: ^9.0
README
A Laravel package for seamless integration with Sendy email marketing platform.
Features
- 🔄 Automatic subscriber synchronization with Sendy
- 🎯 Flexible field mapping
- 🚀 Artisan command for bulk synchronization
- 🔍 Event-driven architecture
- 💾 Cache-based tracking
- ⚡ Efficient chunk processing
- 🛡️ Error handling and logging
Laravel Support
Requirements
- PHP 7.4+
- Laravel 6.0 - 10.0
- Sendy installation
Installation
composer require skaisser/larasendy
Configuration
Publish the configuration file:
php artisan vendor:publish --provider="Skaisser\LaraSendy\LaraSendyServiceProvider"
Configure your .env
file:
SENDY_URL=your-sendy-installation-url SENDY_API_KEY=your-api-key SENDY_LIST_ID=your-list-id
Usage
Basic Setup
- Add the
SendySubscriber
trait to your User model:
use Skaisser\LaraSendy\Traits\SendySubscriber; class User extends Model { use SendySubscriber; }
- Configure field mapping in
config/sendy.php
:
'fields_mapping' => [ 'email' => 'email', 'name' => 'name', 'company' => 'company', 'country' => 'country' ]
Automatic Synchronization
The package automatically syncs users when they are:
- Created
- Updated
- Deleted (configurable behavior)
Manual Synchronization
Use the artisan command to sync all subscribers:
php artisan sendy:sync
Events
The package dispatches events that you can listen to:
SendySubscriberSynced
: When a subscriber is successfully syncedSendySubscriberFailed
: When sync fails
Cache Management
Sync status is tracked in cache:
- Success:
sendy_sync_status_{id}
- Errors:
sendy_sync_error_{id}
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email the author instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.