定制 chagamkamalakar/hypermedia 二次开发

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

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

chagamkamalakar/hypermedia

Composer 安装命令:

composer require chagamkamalakar/hypermedia

包简介

This is my first Package

README 文档

README

The main goal of this project is to provide fluent client interface to access REST Server API complying HATEOS.

Install

Via Composer composer require chagamkamalakar/hypermedia="dev-master@dev"

how to use it:

the main part is HttpClient trait. which has 3 abstract methods

abstract function getBaseURL(); abstract function authDetailsUserNameAndPWD(); abstract function possibleURLs($resource);

In order to make use of this things

  1. must implement above 3 methods
  2. your class must implement ArrayAccess interface to provide pagination support ( no need to implement any method, all these methods are implemented by Pagination trait)

abstract function getBaseURL();

return the base uri for API Server

abstract function authDetailsUserNameAndPWD()

If limit rating is there on API ( for Github the limit is 60 req/hr without any authentication)
provide credentials (user_name & password) respectively in array format ['user_name','password'].

abstract function possibleURLs($resource);

see the GitHub example file code there is description is given with an example for Accessing Github api

To understand how to use it see the GitHub file.it's an example to access GitHub data

Pagination is supported in ArrayLike access

Example code

$client = new \GuzzleHttp\Client();

$gitHub = new \HyperMedia\GitHub($client);

$user = $gitHub->users('laravel');

$repos = $user->repos();

$repo = $repos[5];

$issues = $repo->issues();

$tags = $repo->tags();

$issue = $issues[0];

echo $issue->title. "\n";

echo $issue->body ."\n";

$issue = $issues[50];

echo $issue->title. "\n";

echo $issue->body ."\n";

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固