messente / messente-phonebook-php
此软件包已被弃用,不再维护。没有建议的替代软件包。
Messente电话簿的RESTful API
0.2.0
2019-01-10 07:35 UTC
Requires
- php: >=5.6
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is not auto-updated.
Last update: 2021-01-21 17:21:56 UTC
README
PhonebookApi - Messente电话簿API的PHP客户端
需求
PHP 5.5及更高版本
安装与使用
Composer
要通过Composer安装绑定,请在composer.json
中添加以下内容:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/messente/messente-phonebook-php.git"
}
],
"require": {
"messente/messente-phonebook-php": "*@master"
}
}
然后运行composer install
手动安装
下载文件并包含autoload.php
require_once('/vendor/autoload.php');
测试
要运行单元测试
composer install
./vendor/bin/phpunit
入门
请按照安装过程进行操作,然后运行以下命令:
<?php require_once(__DIR__ . '/vendor/autoload.php'); use Messente\Phonebook\Configuration; use Messente\Phonebook\Api\BlacklistApi; use GuzzleHttp\Client; // Configure HTTP basic authorization: basicAuth $config = Configuration::getDefaultConfiguration() ->setUsername('YOUR_MESSENTE_API_USERNAME') ->setPassword('YOUR_MESSENTE_API_PASSWORD'); $apiInstance = new BlacklistApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new Client(), $config ); try { $response = $apiInstance->fetchBlacklist(); echo $response; } catch (Exception $e) { echo 'Exception when calling fetchBlacklist: ', $e->getMessage(), PHP_EOL; } // try { // $apiInstance->addToBlacklist(['phoneNumber' => '+37255555555']); // } catch (Exception $e) { // echo 'Exception when calling addToBlacklist: ', $e->getMessage(), PHP_EOL; // } // try { // $apiInstance->isBlacklisted('+37255555555'); // } catch (Exception $e) { // echo 'Exception when calling isBlacklisted: ', $e->getMessage(), PHP_EOL; // } // try { // $apiInstance->removeFromBlacklist('+37255555555'); // } catch (Exception $e) { // echo 'Exception when calling removeFromBlacklist: ', $e->getMessage(), PHP_EOL; // } ?>
API端点文档
所有URI相对于https://api.messente.com/v1
类 | 方法 | HTTP请求 |
---|---|---|
BlacklistApi | addToBlacklist | POST /phonebook/blacklist |
BlacklistApi | fetchBlacklist | GET /phonebook/blacklist |
BlacklistApi | isBlacklisted | GET /phonebook/blacklist/{phone_number} |
BlacklistApi | removeFromBlacklist | DELETE /phonebook/blacklist/{phone_number} |
模型文档
- ErrorItem
- ErrorResponse
- FetchBlacklistSuccess
- NumberToBlacklist
- ResponseErrorCode
- ResponseErrorTitle
授权文档
basicAuth
- 类型: HTTP基本认证