PHP code example of railroad / maropost

1. Go to this page and download the library: Download railroad/maropost 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/ */

    

railroad / maropost example snippets


/** @var Railroad\Maropost\Services\ContactService $contactService */
protected $contactService;
public function __constructor(Railroad\Maropost\Services\ContactService $contactService){
    $this->contactService = $contactService;
}

use Railroad\Maropost\Services\ContactService;

/** @var ContactService $contactService */
protected $contactService;
public function __constructor(ContactService $contactService){
    $this->contactService = $contactService;
}

$content = $this->contactService->createOrUpdate(ContactVO $contact);

$content = $this->contactService->update($contactId, ContactVO $contact);

$content = $this->contactService->findOneByEmail($email);

$content = $this->contactService->findOneById($id);

$content = $this->contactService->addContactToLists($listIds, $contactId);

$content = $this->contactService->removeContactFromLists($listIds, $contactId);

$content = $this->contactService->getListContacts($listId);

$content = $this->contactService->deleteContactByEmail($email);

$content = $this->contactService->addTagsToContact($contactId, $tags);

$content = $this->contactService->removeTagsFromContact($contactId, $tags);

/** @var Railroad\Maropost\Services\ListService $listService */
protected $listService;
public function __constructor(Railroad\Maropost\Services\ListService $listService){
    $this->listService = $listService;
}

use Railroad\Maropost\Services\ListService;

/** @var ListService $listService */
protected $listService;
public function __constructor(ListService $listService){
    $this->listService = $listService;
}

$content = $this->listService->index();

$content = $this->listService->create(ListVO $list);

$content = $this->listService->update($id, ListVO $list);

$content = $this->listService->delete($listId);

$content = $this->listService->show($listId);

/** @var Railroad\Maropost\Services\TagService $tagService */
protected $tagService;
public function __constructor(Railroad\Maropost\Services\TagService $tagService){
    $this->tagService = $tagService;
}

use Railroad\Maropost\Services\TagService;

/** @var TagService $tagService */
protected $tagService;
public function __constructor(TagService $tagService){
    $this->tagService = $tagService;
}

$content = $this->tagService->create(TagVO $tag);

$content = $this->tagService->findByName($name);

$content = $this->tagService->findById($tagId);

$content = $this->tagService->delete($tagId);