承接 craftcodery/clicksend 相关项目开发

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

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

craftcodery/clicksend

最新稳定版本:4.0.0

Composer 安装命令:

composer require craftcodery/clicksend

包简介

ClickSend integration for Laravel

关键字:

README 文档

README

This package makes it easy to send letters and postcards via ClickSend for your Laravel app.

Installation

You can install the package via composer:

composer require craftcodery/clicksend

Preparing the database

You must publish and run migrations:

php artisan vendor:publish --provider="CraftCodery\ClickSend\ClickSendServiceProvider" --tag="migrations"
php artisan migrate

Publishing the config file

You can publish the config file with:

php artisan vendor:publish --provider="CraftCodery\ClickSend\ClickSendServiceProvider" --tag="config"

Publishing the config allows you to customize the environment variables used for setting your ClickSend username and API key.

Configuring for usage

Start by setting environment variables for your ClickSend username and API Key. By default the package looks for CLICKSEND_USERNAME and CLICKSEND_KEY.

Any models that you want to be able to receive mailers need to use CraftCodery\ClickSend\Traits\CanReceiveMailers. This trait only requires one method, mailerRecipientAddress, which returns an array of formatted address information. An example of the required array structure is below.

/**
 * Get the recipient's address for ClickSend mailers.
 *
 * @return array
 */
public function mailerRecipientAddress()
{
    return [
        'address_name'        => $this->name,
        'address_line_1'      => $this->address,
        'address_line_2'      => $this->address_2,
        'address_city'        => $this->city,
        'address_state'       => $this->state,
        'address_postal_code' => $this->postal_code,
        'address_country'     => $this->country,
    ];
}

Similarly, any models that you want to be able to send mailers need to use CraftCodery\ClickSend\Traits\CanSendMailers. This trait only requires the method mailerReturnAddress, which returns an array of formatted return address information. An example of the required array structure is below.

/**
 * Get the sender's return address for ClickSend mailers.
 *
 * @return array
 */
public function mailerReturnAddress()
{
    return [
        'address_name'        => $this->name,
        'address_line_1'      => $this->address,
        'address_line_2'      => $this->address_2,
        'address_city'        => $this->city,
        'address_state'       => $this->state,
        'address_postal_code' => $this->postal_code,
        'address_country'     => $this->country,
    ];
}

Sending items

The sendLetterTo and sentPostcardTo methods are available to any models using the CanSendMailers trait.

Each method requires a recipient model (that uses the CanReceiveMailers trait) as the first parameter. Letters require the content as the second parameter, while postcards require a PDF URL for the second parameter, and the content for the third parameter.

The PDF used as the second parameter in the postcard method will be sent on the front of the postcard. The content will be sent on the rear.

$user->sendLetterTo($recipient, 'This is the content of the letter.');
$user->sendPostcardTo($recipient, 'https://example.com/postcard-image.pdf', 'This is the content on the rear of the postcard.');

License

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: Blade

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固