2017 © Pedro Peláez
 

library php_sdk_skeleton

A skeleton for PHP SDK development

image

leo108/php_sdk_skeleton

A skeleton for PHP SDK development

  • Sunday, August 13, 2017
  • by leo108
  • Repository
  • 2 Watchers
  • 21 Stars
  • 85 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 12 % Grown

The README.md

PHP SDK Skeleton

A skeleton for PHP SDK development., (*1)

Installation

composer require leo108/php_sdk_skeleton -vvv, (*2)

Quick Start

Let's get started with creating a simple github sdk using REST Api., (*3)

Create a class extends Leo108\SDK\AbstractApi, override the getFullApiUrl method., (*4)

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., (*5)

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., (*6)

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

All Done. Let's try it out., (*7)

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

Work with

The Versions

13/08 2017

dev-master

9999999-dev

A skeleton for PHP SDK development

  Sources   Download

MIT

The Requires

 

13/08 2017

0.0.1

0.0.1.0

A skeleton for PHP SDK development

  Sources   Download

MIT

The Requires