定制 leo108/php_sdk_skeleton 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

leo108/php_sdk_skeleton

Composer 安装命令:

composer require leo108/php_sdk_skeleton

包简介

A skeleton for PHP SDK development

README 文档

README

A skeleton for PHP SDK development.

Installation

composer require leo108/php_sdk_skeleton -vvv

Quick Start

Let's get started with creating a simple github sdk using REST Api.

Create a class extends Leo108\SDK\AbstractApi, override the getFullApiUrl method.

class RepositoryApi extends Leo108\SDK\AbstractApi {
    protected function getFullApiUrl($api)
    {
        return 'https://api.github.com/'.$api;
    }
}

Create a method called list which will list all repos of a user.

class RepositoryApi extends Leo108\SDK\AbstractApi {
    public function list($username)
    {
        return $this->apiGet('users/'.$username.'/repos');
    }
}

Create a class extends Leo108\SDK\SDK, implement the getApiMap method.

class GithubSDK extends Leo108\SDK\SDK {
    protected function getApiMap()
    {
        return [
            'repository' => RepositoryApi::class,
        ];
    }
}

All Done. Let's try it out.

$sdk  = new GithubSDK();
// $resp is a Psr\Http\Message\ResponseInterface object
$resp = $sdk->repository->list('leo108');
var_dump($resp->getBody()->getContents());

Work with

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固