承接 theafolayan/listmonk-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

theafolayan/listmonk-laravel

最新稳定版本:1.3.0

Composer 安装命令:

composer require theafolayan/listmonk-laravel

包简介

A Laravel package for interacting with the Listmonk API

README 文档

README

A Laravel package for interacting with the Listmonk API.

Installation

  1. Install the package via Composer:

    composer require theafolayan/listmonk-laravel
  2. Publish the configuration file:

    php artisan vendor:publish --tag=listmonk-config
  3. Configure your .env file with the following variables:

    LISTMONK_BASE_URL=
    LISTMONK_API_USER=
    LISTMONK_API_TOKEN=

Usage

Example: Manage Subscribers

Get all subscribers:

use Theafolayan\ListmonkLaravel\Facades\Listmonk;

$subscribers = Listmonk::getSubscribers();

Add a subscriber

$newSubscriber = Listmonk::createSubscriber([
    'email' => 'john.doe@example.com',
    'name' => 'John Doe',
    'status' => 'enabled',
]);

Example: Manage Lists

Get all lists:

$lists = Listmonk::getLists();

Create a new list

$newList = Listmonk::createList([
    'name' => 'Weekly Newsletter',
    'description' => 'Updates and news every week.',
]);

Facade

You can use the Listmonk facade to interact with the Listmonk API:

use Theafolayan\ListmonkLaravel\Facades\Listmonk;

$subscribers = Listmonk::getSubscribers();
$list = Listmonk::createList(['name' => 'New List']);

Dependency Injection

Alternatively, you can inject the Listmonk class into your services:

use Theafolayan\ListmonkLaravel\Listmonk;

class YourService
{
    protected $listmonk;

    public function __construct(Listmonk $listmonk)
    {
        $this->listmonk = $listmonk;
    }

    public function getSubscribers()
    {
        return $this->listmonk->getSubscribers();
    }
}

Methods

  • getSubscribers(array $filters = [])
  • createSubscriber(array $data)
  • getLists()
  • createList(array $data)

Contributing

Contributions are welcome! To contribute:

  • Fork the repository.
  • Create a feature branch.
  • Submit a pull request.

License

This package is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 1.39k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-05