承接 picqer/api-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

picqer/api-client

Composer 安装命令:

composer require picqer/api-client

包简介

A PHP Client for the Picqer API

README 文档

README

This project is a PHP Library to use the Picqer API from your PHP application.

Full documentation for the API can be found on picqer.com/en/api

Installation

This project can easily be installed through Composer.

composer require picqer/api-client

Example: Get orders

<?php

require __DIR__ . '/vendor/autoload.php';

$subDomain = 'jansens-webwinkels';
$apiKey = '1023ihs0edfh';

$apiClient = new Picqer\Api\Client($subDomain, $apiKey);
$apiClient->enableRetryOnRateLimitHit();
$apiClient->setUseragent('My amazing app (dev@example.org)');

$orders = $apiClient->getOrders();
var_dump($orders);

Example: Results generator

If you want to loop trough all your products or orders, you can use the results generator. This will give you the results in a loop as soon as the API returns them. This will also help with memory usage.

<?php

require __DIR__ . '/vendor/autoload.php';

$subDomain = 'jansens-webwinkels';
$apiKey = '1023ihs0edfh';

$apiClient = new Picqer\Api\Client($subDomain, $apiKey);
$apiClient->enableRetryOnRateLimitHit();
$apiClient->setUseragent('My amazing app (dev@example.org)');

foreach ($apiClient->getResultGenerator('order') as $order) {
    var_dump($order);
}

More examples

Review the examples in the examples/ folder.

Helpful methods

setUseragent()

It is helpful for us if you set the user agent with the name of the application or developer that build the application. Then we can contact you if we see weird behaviour.

sendRequest()

This is the main method of the client that sends the API request. If there are new API endpoints that are not yet implemented in this client with dedicated methods, you can create the request yourself with sendRequest().

getResultGenerator()

This is a generator for all listing methods like getOrders and getProducts. This will help reduce the memory usage of your application when looping through a lot of orders or products.

enableDebugmode()

This flag gives you a lot of debug information about the request that the client send and the raw response it got as a result.

Rate limits

Please keep in mind the rate limit of the Picqer API. In the result array you get a 'rate-limit-remaining' key with the remaining requests you can do in this minute. Try not to make any more requests if this is 0 if you can.

When you try another request, the request will fail. This client will throw you a RateLimitException. You can catch those and try your request again later.

We also have an option $apiClient->enableRetryOnRateLimitHit() you can use to enable retry's of requests when you hit a rate limit. When the client hits the rate limit, it will sleep for 20 seconds and try the same request again.

Webhooks helper

This client also contains a helper for receiving webhooks, including a signature checker. This is included in the PicqerWebhook class.

To receive a webhook, you only need the following:

<?php

require __DIR__ . '/vendor/autoload.php';

$webhook = Picqer\Api\PicqerWebhook::retrieve();

echo 'Hook received: ' . $webhook->getName() . ' that was triggered at ' . $webhook->getEventTriggeredAt() . PHP_EOL;
echo $webhook->getData();

We recommend using signature validation to be sure the webhook was sent by Picqer. Create a hook with a secret, then check the signature of the webhook with that secret as follows:

<?php

require __DIR__ . '/vendor/autoload.php';

$webhook = Picqer\Api\PicqerWebhook::retrieveWithSecret('your-secret');

This will throw an WebhookSignatureMismatchException if the secret or signatures do not match.

Support

Need support implementing the Picqer API? Feel free to contact us

picqer/api-client 适用场景与选型建议

picqer/api-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 339.33k 次下载、GitHub Stars 达 19, 最近一次更新时间为 2013 年 08 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「picqer」 「wms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 picqer/api-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 picqer/api-client 我们能提供哪些服务?
定制开发 / 二次开发

基于 picqer/api-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 339.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 19
  • 点击次数: 21
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 19
  • Watchers: 6
  • Forks: 25
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-08-26