escolalms / mailerlite
Escola LMS MailerLite integration.
Installs: 7 179
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires
- php: >=7.4
- escolalms/auth: ^0
- escolalms/core: ^1
- escolalms/settings: ^0
- guzzlehttp/guzzle: ^7
- laravel/framework: >=8.0
- mailerlite/mailerlite-api-v2-php-sdk: ^0.3.2
- php-http/guzzle7-adapter: ^1.0
Requires (Dev)
- escolalms/cart: ^0
- orchestra/testbench: >=5.0
- phpunit/phpunit: ^9.0
README
What does it do
This package is used for integration with MailerLite after dispatching events.
Installing
composer require escolalms/mailerlite
Example
You can set the package status and api key using the Facade
Config::set('escolalms_mailer_lite.package_status', PackageStatusEnum::ENABLED); Config::set('escolalms_mailer_lite.api_key', '1234);
$this->actingAs($this->user, 'api')->postJson( '/api/admin/config', [ 'config' => [ [ 'key' => 'escolalms_mailer_lite.package_status', 'value' => PackageStatusEnum::ENABLED, ], [ 'key' => 'escolalms_mailer_lite.api_key', 'value' => '1234', ], ] ] );
Group names are also configurable.
$this->actingAs($this->user, 'api')->postJson( '/api/admin/config', [ 'config' => [ [ 'key' => 'escolalms_mailer_lite.group_registered_group', 'value' => 'registered users', ], [ 'key' => 'escolalms_mailer_lite.group_order_paid', 'value' => 'order paid', ], [ 'key' => 'escolalms_mailer_lite.group_left_cart', 'value' => 'left cart', ], ] ] );
Tests
Run ./vendor/bin/phpunit
to run tests.
Listeners
Handling events
EscolaLms\Auth\Events\AccountConfirmed
=> add to group of registered users (escolalms_mailer_lite.group_registered_group
)EscolaLms\Cart\Events\ProductBought
=> add to group of users with paid orders (escolalms_mailer_lite.group_order_paid
)EscolaLms\Auth\Events\AccountBlocked
=> remove from all groupsEscolaLms\Cart\Events\AbandonedCartEvent
=> add to the group of users with abandoned carts (escolalms_mailer_lite.group_left_cart
)EscolaLms\Cart\Events\OrderCreated
=> remove from the group of users with abandoned carts (escolalms_mailer_lite.group_left_cart
)