1. Go to this page and download the library: Download dmt-software/laposta-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use DMT\Laposta\Api\Clients\Subscribers;
use DMT\Laposta\Api\Config;
use DMT\Laposta\Api\Factories\CommandBusFactory;
$commandBus = CommandBusFactory::create(Config::load('config.php'));
$client = new Subscribers($commandBus);
use DMT\CommandBus\Validator\ValidationException;
use DMT\Laposta\Api\Entity\BaseCustomFields;
use DMT\Laposta\Api\Entity\Subscriber;
use DMT\Laposta\Api\Clients\Subscribers;
use Psr\Http\Client\ClientExceptionInterface;
try {
/** @var BaseCustomFields $customFields The generated entity for your list */
$subscriber = new Subscriber();
$subscriber->listId = 'BaImMu3JZA';
$subscriber->email = '[email protected]';
$subscriber->customFields = $customFields;
$subscriber->customFields->name = 'John Do';
/** @var Subscribers $client */
$client->create($subscriber, Subscribers::OPTION_SUPPRESS_EMAIL_NOTIFICATION);
} catch (ValidationException $exception) {
// input was wrong
} catch (ClientExceptionInterface $exception) {
// error response
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.