定制 stephenjude/laravel-sendportal 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

stephenjude/laravel-sendportal

最新稳定版本:1.0.2

Composer 安装命令:

composer require stephenjude/laravel-sendportal

包简介

A Laravel Package to work with the SendPortal API

README 文档

README

Latest Version on Packagist Test Suite Total Downloads

The unofficial Laravel Package to work with the SendPortal APIs.

Installation

You can install the package via composer:

composer require stephenjude/laravel-sendportal

Set up

To start using this package, you need to add environment variables for:

  • SENDPORTAL_URL - The url of your Sendportal account like this — https://sendportal.io/api/v1
  • SENDPORTAL_TOKEN - You can generate this from your SendPortal account.

The package will pick these up in its configuration and use these when it resolves an instance of the Client.

Usage

This package can be used by using the SendPortal facade or by injecting the SendPortal\Laravel\Http\Client into a method to instantiate the client:

use SendPortal\Laravel\Contracts\ClientContract;
use SendPortal\Laravel\Facades\SendStack;

/**
 * Without a Facade
 */
$client = app()->make(
    abstract: ClientContract::class,
);

$client->subscribers()->all();


/**
 *  Using the Facade
 */
SendPortal::subscribers()->all();

Getting a list of Subscribers

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::subscribers()->all();

Getting a single Subscriber

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::subscribers()->get(
    subscriber: 1,
);

Creating a new Subscriber

use SendPortal\Laravel\Facades\SendPortal;
use SendPortal\Laravel\Http\Requests\SubscriberRequest;

SendPortal::subscribers()->create(
    request: new SubscriberRequest(
        email: 'contact@sendportal.local', // Required
        firstName: 'Send', // Optional
        lastName: 'Portal', // Optional
        tags: [
            1,
            2,
        ], // Optional
        optOut: false, // Optional
    ),
);

Update a Subscriber

use SendPortal\Laravel\Facades\SendPortal;
use SendPortal\Laravel\Http\Requests\SubscriberRequest;

SendPortal::subscribers()->update(
    id: 1,
    request: new SubscriberRequest(
        email: 'contact@sendportal.local', // Required
        firstName: 'Send', // Optional
        lastName: 'Portal', // Optional
        tags: [
            1,
            2,
        ], // Optional
        optOut: false, // Optional
    ),
);

Deleting a Subscriber

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::subscribers()->delete(
    subscriberId: 1,
);

Attaching a Tag to a Subscriber

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::subscribers()->attachTag(
    subscriberId: 1,
    tagId: 1,
);

Removing a Tag from a Subscriber

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::subscribers()->removeTag(
    subscriberId: 1,
    tagIds: [1, 2],
);

Checking if an email address is an Active Subscriber

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::isActiveSubscriber(
    subscriberId: 1,
);

Getting all Tags

use SendPortal\Laravel\Facades\SendPortal;

SendPortal::tags()->all();

Creating a new Tag

use SendPortal\Laravel\Facades\SendPortal;
use SendPortal\Laravel\Http\Requests\TagRequest;

SendPortal::tags()->create(
    request: new TagRequest(
        name: 'Test', // Required
        subscribers: [1], // Optional
    ),
);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 2.65k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固