professio/inboxify-api-php

Inboxify API PHP 客户端

1.0.4 2022-02-08 01:19 UTC

This package is not auto-updated.

Last update: 2024-09-17 21:26:37 UTC


README

需求

安装

Composer

可以使用 Composer 容易地安装客户端。包名为:inboxify/inboxify-php-api

使用 composer 安装:composer require "inboxify/inboxify-php-api:1.0.*"

example of composer.json

{
    "require": {
        "inboxify/inboxify-php-api": "1.0.*"
    }
}

单个文件分发

您可以在 build/dist/inboxify-php-api.php 文件中找到单个文件分发,其中包含连接的类,您可以轻松将其包含到项目中,而无需使用 composer 或自动加载。

缓存

如果您想使用文件缓存,请确保缓存目录可由代码用户或 web 服务器写入。另外,别忘了缓存目录绝对不能被 web 用户访问。

配置

配置是以下配置指令的关联数组

$config = array(
    // enable or disable cache
    'cache' => true,
    // cache directory (must be writeable, must end with /)
    'cacheDir' => '/tmp/',
    // api endpoint, please do not change this value, unless instructed to
    'endPoint' => 'https://api.inboxify.nl/',
    // your API key
    'key' => 'INSERTAPIKEY',
    // name of the inboxify list you want to use as a default
    'list' => 'INSERTLISTNAME',
    // your API secret
    'secret' => 'INSERTAPISECRET',
    // advanced: socket timeout
    'timeOutSocket' => 10,
    // advanced: socket stream read timeout
    'timeOutStream' => 10,
    // cache time to live in seconds (3600 sec = 1 hour)
    'ttl' => 3600,
);

运行

使用 Composer 安装客户端或将其作为单个文件分发版本包含/require。使用配置示例,并设置以下必需键

  • key:API 密钥
  • secret:API 密码
  • list:默认列表 ID 或名称

然后将配置传递给客户端

<?php

use Inboxify\Api\Client;

try {
  $config = array(/* See configuration example */);
  $client = Client::getInstance($config);

  print $client->isConnected() ? 'Huray!' : 'Yay...';
} catch (\Throwable $e) {
  print 'Something went wrong: ' . $e->getMessage();
}

示例

您可以在 build/examples/example.php 中找到更多示例,涵盖了大多数用例。

文件概览

  • build/:构建文件
  • build/dist/:单个文件分发
  • build/docs/:PHPDoc 相关文件
  • build/examples/:附加示例
  • build/tests/:PHPUnit 相关文件
  • src/:所有 PHP 类
  • src/Inboxify/Api/:所有 PHP API 客户端类
  • src/Inboxify/Test/:所有 PHPUnit 测试类
  • .gitignore:Gitignore 文件
  • LICENSE:MIT 许可证的全文
  • README.md:此文件
  • composer.json:Composer 包定义

版权

MIT 许可证

联系方式

变更日志

  • 1.0.4 (2021-12-24):

    • 更改了 PHP 兼容性为 >= 5.6 - 8.x
  • 1.0.4 (2018-07-15):

    • 添加了分块传输编码支持到 http 客户端,使其符合标准
    • 添加了 gzip 支持到 http 客户端
    • 将单个文件分发更改为 phar 文件
    • ci/cd 与 php qa(docker + php qa 工具 + gitlab-ci)
    • 配置不需要以 / 结尾的端点
  • 1.0.2 (2016-06-30):

    • 仅重新构建单个文件分发
  • 1.0.1 (2016-06-30):

    • 更改了 API 端点、电子邮件、URL 从 inboxify.eu 到 inboxify.nl
    • 修复了 README.md 的格式问题
  • 1.0.0 (2016-12-19):

    • 初始版本