seeuletter/seeuletter-php
Composer 安装命令:
composer require seeuletter/seeuletter-php
包简介
Seeuletter.com API PHP wrapper.
README 文档
README
Seeuletter.com PHP Client is a simple but flexible wrapper for the Seeuletter.com API. See full Seeuletter.com documentation here. For best results, be sure that you're using the latest version of the Seeuletter API and the latest version of the PHP wrapper.
Table of Contents
Getting Started
Here's a general overview of the Seeuletter services available, click through to read more.
Please read through the official API Documentation to get a complete sense of what to expect from each endpoint.
Registration
First, you will need to first create an account at Seeuletter.com and obtain your Test and Live API Keys.
Once you have created an account, you can access your API Keys from the API keys Panel.
Installation
The recommended way to install Seeuletter.com PHP Client is through Composer.
// Install Composer
curl -sS https://getcomposer.org/installer | php
// Add Seeuletter.com PHP client as a dependency
composer require seeuletter/seeuletter-php
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
Letters
Create a new Letter
<?php require 'vendor/autoload.php'; // Provide an API Key in the class constructor // in order to instantiate the Seeuletter object $apiKey = 'your API Key here'; $seeuletter = new \Seeuletter\Seeuletter($apiKey); $to_address = array( 'name' => 'Seeuletter', 'address_line1' => '30 rue de rivoli', 'address_line2' => '', 'address_city' => 'Paris', 'address_country' => 'France', 'address_postalcode' => '75004' ); $letter = $seeuletter->letters()->create(array( 'to' => $to_address, 'source_file' => '@test.pdf', 'description' => 'Test Letters', 'color' => 'bw', 'source_file_type' => 'file', 'postage_type' => 'verte' )); print_r($letter); ?>
Create a new Electronic Letter
<?php require '../vendor/autoload.php'; $apiKey = 'your API key here'; $seeuletter = new \Seeuletter\Seeuletter($apiKey); $to_address_electronic = array( 'first_name' => 'Erlich', 'last_name' => 'Dumas', 'company' => 'Seeuletter', 'email' => 'seeuletter@example.com' ); $letter = $seeuletter->letters()->createElectronic(array( 'to' => $to_address_electronic, 'source_file' => '<html>This is the electronic letter attached document</html>', 'source_file_type' => 'html', 'description' => 'Test Electronic Letters', 'content' => 'Please review the attached documents', 'postage_type' => 'lre' )); print_r($letter); ?>
Get all Letters
<?php require 'vendor/autoload.php'; $seeuletter = new \Seeuletter\Seeuletter('test_12345678901234567890'); $letters = $seeuletter->letters()->all(); print_r($letters); ?>
Get a specific Letter
<?php require 'vendor/autoload.php'; $seeuletter = new \Seeuletter\Seeuletter('test_12345678901234567890'); $letter = $seeuletter->letters()->get('LETTER_ID'); print_r($letter); ?>
Accounts
Create a new account for the company
<?php require 'vendor/autoload.php'; // Provide an API Key in the class constructor // in order to instantiate the Seeuletter object $seeuletter = new \Seeuletter\Seeuletter('test_12345678901234567890'); $account = $seeuletter->accounts()->create(array( 'email' => "msb.partner@example.com", 'name' => "Erlich Bachman", 'phone' => "+33104050607", 'company_name' => "MSB Partner from PHP Wrapper", 'address_line1' => '30 rue de rivoli', 'address_line2' => '', 'address_city' => 'Paris', 'address_country' => 'France', 'address_postalcode' => '75004' )); print_r($account); ?>
Update the account company email
<?php require 'vendor/autoload.php'; // Provide an API Key in the class constructor // in order to instantiate the Seeuletter object $seeuletter = new \Seeuletter\Seeuletter('test_12345678901234567890'); $account_response = $seeuletter->accounts()->updateEmail("COMPANY_ID_HERE", "msb.partner.new@example.com"); ?>
Invoices
List all invoices for a company
<?php require 'vendor/autoload.php'; $seeuletter = new \Seeuletter\Seeuletter('test_12345678901234567890'); $letters = $seeuletter->invoices()->all(); print_r($letters); ?>
Get a specific invoice
<?php require 'vendor/autoload.php'; $seeuletter = new \Seeuletter\Seeuletter('test_12345678901234567890'); $letter = $seeuletter->invoices()->get('INVOICE_ID'); print_r($letter); ?>
Examples
We've provided various examples for you to try out here.
=======================
Copyright © 2017 Seeuletter.com
Released under the MIT License, which can be found in the repository in LICENSE.txt.
seeuletter/seeuletter-php 适用场景与选型建议
seeuletter/seeuletter-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 64.76k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 09 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「rest」 「api」 「web service」 「wrapper」 「mailing」 「printing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 seeuletter/seeuletter-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 seeuletter/seeuletter-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 seeuletter/seeuletter-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Model of a web-based resource
A PSR-7 compatible library for making CRUD API endpoints
Retrieve a WebResourceInterface instance over HTTP
Api bundle
Selectize Theme for Bootstrap 4
Provides command to manage a web library directory
统计信息
- 总下载量: 64.76k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-11