niklan/dellin-api 问题修复 & 功能扩展

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

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

niklan/dellin-api

Composer 安装命令:

composer require niklan/dellin-api

包简介

PHP SDK for Dellin API.

README 文档

README

What is it?

A PHP library which implements API for https://dev.dellin.ru.

Installation

PHP 7.2+ as minimum requirement because of use new features.

Install package via compose:

$ composer require niklan/dellin-api

Documentation

Examples

The library is just a set of PHP wrappers to destination endpoints for Dellin.

Currently library supports only json format. There is no decoder and encoder for XML and I have not future plans to implement it.

Public API auth

The minimum required authentication at dev.dellin.ru is appkey, which is represented by AppkeyAuth.

$auth = new AppkeyAuth('MY-DELLIN-APPKEY');

Session Auth

This authentication method used for some "client specific" API's that requires sessionID.

$auth = new SessionAuth('MY-DELLIN-APPKEY', 'SESSION-TOKEN-ID');

Build a Client

For sending request it's need to be isntantiated HttpClient representation. It requires you to pass one of two authentication methods. They will be used during request sending.

$client = new HttpClient($auth);

Send request

You can send request to any Dellin api by using request() method from $client.

In first argument you pass API endpoint without base uri and format, and in second your params.

// @see https://dev.dellin.ru/api/auth/login/
$response = $client->request('/v1/customers/login', ['login' => 'example', 'password' => '123']);
$result = $response->getResult();

Send request using PHP wrapper.

Wrappers for endpoints is simple and just collect data to send in more friendly way.

The request above using wrapper:

$request = new Login('example' , '123');
$response = $client->execute($request);
$result = $response->getResult();

In that way:

  • You don't need to handle endpoints every time. You just use semantic object.
  • All required by an API params will be required by object constructor, so you don't miss something.
  • All optional params set by setters.

It's better to implement php-http.org with PSR-18 in 2.x verions, if it will be created.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-10-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固