lukaszlesniewski / expertsender
Simple API for ExpertSender service
dev-master
2023-12-12 15:51 UTC
This package is auto-updated.
Last update: 2025-06-12 19:12:01 UTC
README
Simple ExpertSender Service API (ECDP) for Laravel
Installation
-
Require package:
composer require lukaszlesniewski/expertsender
-
Add following package service provider in config/app.php file:
Lukaszlesniewski\ExpertSender\Providers\ExpertSenderProvider::class
-
Publish package config:
php artisan vendor:publish --provider="Lukaszlesniewski\ExpertSender\Providers\ExpertSenderProvider"
Usage examples
Add new subscriber
$es = new Customers(YOUR_API_KEY);
$es->setEmail($email);
$es->setConsentsData(1, 'True');
$es->setConsentsData(2, 'True');
$result = $es->add(ExpertSenderEnum::MODE_ADD);
if ($result->ifSuccess()) { ... }
Get information about the subscriber by e-mail
$es = new Customers(YOUR_API_KEY);
$result = $es->getByEmail($customerEmail);
Get information about the subscriber by customer ID
$es = new Customers(YOUR_API_KEY);
$result = $es->getById($customerId);
Results object
You can use the following methods to read result of the request
ifSuccess()
– returns true if http_code for request is less than 299getCode()
– returns http code for requestgetInfo($option)
– returns the information defined in $option variable; if $option is null, it returns the array containing all informationgetResponse()
– returns array containing the resultgetMessage()
– returns the message based on the http code