2017 © Pedro Peláez
 

library hypermedia

This is my first Package

image

chagamkamalakar/hypermedia

This is my first Package

  • Saturday, November 14, 2015
  • by kamalakar
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

HyperMedia Client

The main goal of this project is to provide fluent client interface to access REST Server API complying HATEOS., (*1)

Install

Via Composer composer require chagamkamalakar/hypermedia="dev-master@dev", (*2)

how to use it:

the main part is HttpClient trait. which has 3 abstract methods, (*3)

abstract function getBaseURL(); abstract function authDetailsUserNameAndPWD(); abstract function possibleURLs($resource);, (*4)

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

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

Pagination is supported in ArrayLike access, (*7)

Example code

$client = new \GuzzleHttp\Client();, (*8)

$gitHub = new \HyperMedia\GitHub($client);, (*9)

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

$repos = $user->repos();, (*11)

$repo = $repos[5];, (*12)

$issues = $repo->issues();, (*13)

$tags = $repo->tags();, (*14)

$issue = $issues[0];, (*15)

echo $issue->title. "\n";, (*16)

echo $issue->body ."\n";, (*17)

$issue = $issues[50];, (*18)

echo $issue->title. "\n";, (*19)

echo $issue->body ."\n";, (*20)

The Versions

14/11 2015

dev-master

9999999-dev https://github.com/chagamkamalakar/

This is my first Package

  Sources   Download

MIT

The Requires

 

The Development Requires

by chagamkamalakar

hypermedia hello world