PHPackages                             adnanhussainturki/listmonk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. adnanhussainturki/listmonk-php

ActiveLibrary[API Development](/categories/api)

adnanhussainturki/listmonk-php
==============================

Package aims to ease up the API calls to a listmonk API from PHP based application

0.1(2y ago)36242MITPHP

Since Nov 12Pushed 2y ago1 watchersCompare

[ Source](https://github.com/AdnanHussainTurki/listmonk-php)[ Packagist](https://packagist.org/packages/adnanhussainturki/listmonk-php)[ RSS](/packages/adnanhussainturki-listmonk-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

ListMonk - PHP
==============

[](#listmonk---php)

The package allows easy access to ListMonk API from PHP based applications.

### Installation

[](#installation)

You can install this library to your project via composer using the following command:

`composer require adnanhussainturki/listmonk-php`

### Usage

[](#usage)

```

```

### Managing lists

[](#managing-lists)

```

// Get all lists
$lists = $listMonk->lists()->getAll();
echo "All lists:\n";
foreach ($lists as $list) {
    echo $list->getId() . " - " . $list->getName() . "\n";
}

// Get a list by id
$list = $listMonk->lists()->get(3);
echo "List with id 3:\n";
echo $list->getId() . " - " . $list->getName() . "\n";

// Create a new list
$newList = new \AdnanHussainTurki\ListMonk\Models\MonkList();
$newList->setName("Test List");
$newList->setType("private");
$newList->setOptin("single");
$newList->setTags(["test", "list"]);
$newListMonk = $listMonk->lists()->create($newList);
echo "New list created:\n";
echo $newListMonk->getId(). " - " . $newListMonk->getName() . "\n";

// Update the created list
$newListMonk->setName("Test List Updated");
$newListMonk->setType("public");
$newListMonk->setOptin("double");
$newListMonk->setTags(["test", "list", "updated"]);
$updatedList = $listMonk->lists()->update($newListMonk);
echo "Updated list:\n";
echo $updatedList->getId(). " - " . $updatedList->getName() . "\n";

// Delete the created list
$deletedList = $listMonk->lists()->delete($updatedList->getId());
echo "List deleted:\n";
echo $deletedList->getId(). " - " . $deletedList->getName() . "\n";
```

### Managing subscribers

[](#managing-subscribers)

```
