setono/kraken-io-php-sdk
Composer 安装命令:
composer require setono/kraken-io-php-sdk
包简介
A PHP SDK for the kraken.io API
README 文档
README
A PHP SDK for the Kraken.io API.
Installation
Download
Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:
$ composer require setono/kraken-io-php-sdk
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Install HTTP client
This library is HTTP client agnostic so you need to provide your own PSR18 HTTP client implementation. If you don't want to bother with this, you can just do this:
$ composer require kriswallsmith/buzz nyholm/psr7
This will install the PSR18 HTTP client, Buzz and HTTP message factories used to create requests, responses, and streams.
Usage
Upload file via URL and wait for a response
<?php use Setono\Kraken\Client\Client; use Setono\Kraken\Client\Response\WaitResponse; $client = new Client('Your API key', 'Your API secret'); /** @var WaitResponse $response */ $response = $client->url('https://www.your-domain.com/your/image.jpg', true); /** @var SplFileInfo $optimizedImageFile */ $optimizedImageFile = $response->getFile();
Get user status
<?php use Setono\Kraken\Client\Client; use Setono\Kraken\Client\Response\UserStatusResponse; $client = new Client('Your API key', 'Your API secret'); /** @var UserStatusResponse $response */ $response = $client->status(); echo sprintf('Quota total: %s', $response->getQuotaTotal()); echo sprintf('Quota used: %s', $response->getQuotaUsed()); echo sprintf('Quota remaining: %s', $response->getQuotaRemaining());
I want to use my own HTTP client implementation and message factories
You can inject your own implementations when instantiating the client:
<?php use Setono\Kraken\Client\Client; $client = new Client('Your API key', 'Your API secret', $httpClient, $httpRequestFactory, $httpStreamFactory);
setono/kraken-io-php-sdk 适用场景与选型建议
setono/kraken-io-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30.01k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 setono/kraken-io-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 setono/kraken-io-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 30.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 15
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-21