karix/karix-lib
Composer 安装命令:
composer require karix/karix-lib
包简介
README 文档
README
Karix API lets you interact with the Karix platform using an omnichannel messaging API. It also allows you to query your account, set up webhooks and buy phone numbers.
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 2.0
- Package version: 2.0.0
- Build package: io.swagger.codegen.languages.PhpClientCodegen
Requirements
PHP 5.6 and later
Installation & Usage
Composer
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/karixtech/karix-php.git"
}
],
"require": {
"karixtech/karix-php": "2.0.0"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php:
require_once('/path/to/karix-php/vendor/autoload.php');
Tests
To run the unit tests:
composer install
./vendor/bin/phpunit
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure HTTP basic authorization: basicAuth $config = Karix\Configuration::getDefaultConfiguration() ->setUsername('ACCOUNT_ID') ->setPassword('ACCOUNT_TOKEN'); $apiInstance = new Karix\Api\MessageApi( // 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 GuzzleHttp\Client(), $config ); date_default_timezone_set('UTC'); // Create Message object $message = (new \Karix\Model\CreateMessage()) ->setChannel("sms") //Or use "whatsapp" ->setSource("+1XXX2321XXX") ->setDestination(["+1XXX8323XXX", "+1XXX3234XXX"]) ->setContent(["text" => "Sent from Karix PHP SDK"]); try { $result = $apiInstance->sendMessage($message); print_r($result); } catch (Exception $e) { echo 'Exception when calling MessageApi->sendMessage: ', $e->getMessage(), PHP_EOL; } ?>
Documentation for API Endpoints
All URIs are relative to https://api.karix.io
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AccountsApi | createSubaccount | POST /account/ | Create a new subaccount |
| AccountsApi | getSubaccount | GET /account/ | Get a list of accounts |
| AccountsApi | getSubaccountById | GET /account/{uid}/ | Get details of an account |
| AccountsApi | patchSubaccount | PATCH /account/{uid}/ | Edit an account |
| MessageApi | getMessage | GET /message/ | Get list of messages sent or received |
| MessageApi | getMessageById | GET /message/{uid}/ | Get message details by id. |
| MessageApi | sendMessage | POST /message/ | Send a message to a list of destinations |
| NumberApi | deleteNumber | DELETE /number/{num}/ | Unrent number from your account |
| NumberApi | getNumber | GET /number/ | Get details of all phone numbers linked to your account. |
| NumberApi | getNumberDetails | GET /number/{num}/ | Get details of a number |
| NumberApi | patchNumberDetails | PATCH /number/{num}/ | Edit phone number belonging to your account |
| NumberApi | rentNumber | POST /number/ | Rent a phone number |
| NumberSearchApi | searchNumber | GET /numbersearch/ | Query for phone numbers in our inventory. |
| WebhookApi | createWebhook | POST /webhook/ | Create webhooks to receive Message |
| WebhookApi | deleteWebhookById | DELETE /webhook/{uid}/ | Delete a webhook by ID |
| WebhookApi | getWebhook | GET /webhook/ | Get a list of your webhooks |
| WebhookApi | getWebhookById | GET /webhook/{uid}/ | Get a webhook by ID |
| WebhookApi | patchWebhook | PATCH /webhook/{uid}/ | Edit a webhook |
Documentation For Models
- AccountListResponse
- AccountNumberListResponse
- AccountNumberResponse
- AccountResponse
- CreateAccount
- CreateMessage
- CreateMessageContent
- CreateMessageContentLocation
- CreateWebhook
- EditAccount
- EditAccountNumber
- EditWebhook
- ErrorResponse
- ErrorResponseError
- InsufficientBalanceResponse
- InsufficientBalanceResponseError
- Message
- MessageChannelDetails
- MessageChannelDetailsSms
- MessageChannelDetailsWhatsapp
- MessageContent
- MessageContentLocation
- MessageCreatedResponse
- MessageError
- MessageListResponse
- MessageResponse
- MetaResponse
- NotFoundResponse
- NotFoundResponseError
- NumberRentedResponse
- PhoneNumber
- PhoneNumberListResponse
- PhoneNumberRate
- PhoneNumberRegion
- PhoneNumberService
- RentNumber
- UnauthorizedResponse
- UnauthorizedResponseError
- WebhookListResponse
- WebhookResponse
- Account
- AccountNumber
- ArrayMetaResponse
- MetaResponseWithBalance
- ObjectMetaResponse
- Webhook
Documentation For Authorization
basicAuth
- Type: HTTP basic authentication
Author
karix/karix-lib 适用场景与选型建议
karix/karix-lib 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 93 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 06 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「sms」 「message」 「sdk」 「whatsapp」 「Karix」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 karix/karix-lib 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 karix/karix-lib 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 karix/karix-lib 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP AMQP Binding Library
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
yii2-sms expand
Message queue statistics for OroPlatform
Behat extention for RabbitMQ
统计信息
- 总下载量: 93
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-29