dropcart/php-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dropcart/php-client

Composer 安装命令:

composer require dropcart/php-client

包简介

Use this package to communicate with the Dropcart engine on a PHP server.

README 文档

README

See also GitHub Pages: https://dropcart.github.io/php-client/

Dropcart makes it extremely easy setting up an online shop. All orders, payments and invoices are created and processed automatically. There is no need for for pushing the order manually to a wholesaler, or to create a package slip, or whatever.

This Dropcart PHP Client is the official PHP client for the REST API provided by Dropcart for setting up your own web frontend.

Installation

Installation is rather easy. This client is available as a package on Packagist and thus addable to your project via composer. This is the preferred method.

The client is also available as standalone .zip.

Via composer (preferred)

$ composer require dropcart/dropcart-php-client

Add require vendor/autoload.php to the files where you want to use the client. (../ is of course relative to where you require the file)

Standalone

  1. Download the latest version of the build/DropcartPhpClient.zip
  2. Extract and upload via (S)FTP to your shared hosting just outside of de document root.
  3. Add require ../vendor/autoload.php to the files where you want to use the client. (../ is of course relative to where you require the file)

Usage

You'll need your public and private key. Login on the Dropcart Management Console or register to obtain those keys.

First set your keys
\Dropcart\PhpClient\DropcartClient::setPublicKey('PUBLIC_KEY');
\Dropcart\PhpClient\DropcartClient::setPrivateKey('PRIVATE_KEY');
Making a request

You can make request to the different services by calling it as method:

\Dropcart\PhpClient\DropcartClient::catalog();
\Dropcart\PhpClient\DropcartClient::catalog()->products();
\Dropcart\PhpClient\DropcartClient::catalog()->brands();
\Dropcart\PhpClient\DropcartClient::catalog()->categories();

The latest method is always one of these:

->get(...$args)
->post(...$args)
->put(...$args)
->delete(...$args);

By doing so the code will generate the appropiate URL with the requested HTTP method. For example

\Dropcart\PhpClient\DropcartClient::catalog()->products()->get(12332);
// Will make a GET request to:
// https://rest-api.dropcart.nl/catalog/products/12332

\Dropcart\PhpClient\DropcartClient::catalog(34)->products()->get();
// Will make a GET request to:
// https://rest-api.dropcart.nl/catalog/34/products (this will actually fail because this isn't a valid endpoint)

If you need to send parameters along with a post or put request you'll use addParam($name, $value) or addParams($array)

\Dropcart\PhpClient\DropcartClient::catalog()->products()->addParams([
	'name' => 'New Product',
	'description' => 'A descriptive text about this new and awesome product. You need to buy this, yo!'
])->post();
Getting the response

This client uses the amazing Guzzle for making request. The response are Psr7 Responses. You'll get the wanted JSON by doing:

try {
	$response   = \Dropcart\PhpClient\DropcartClient::catalog(34)->products()->get();
} catch(DropcartClientException $e) {
	die('Client error:' . $e->getMessage());
} catch (\Exception $e)
{
	die('Server error:' . $e->getMessage());
}
	
$json       = $respons->getBody();

For a global overview of all the REST functions check REST.md

License

See the LICENSE file for license rights and limitations (MIT).

Support

Please file an GitHub Issue when there are errors in the code.

When failing to install please contact us: info@dropcart.nl

Nederlands

Met Dropcart is het opzetten van een webshop bijzonder eenvoudig. Alle bestellingen, betalingen en facturen worden automatisch aangemaakt en verwerkt. Het is dus niet meer nodig om handmatig een bestelling bij een groothandel in te voeren, pakbon te verzenden etcetera.

dropcart/php-client 适用场景与选型建议

dropcart/php-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.25k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 05 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-15