Download the PHP package rgarman/sdk-stats without Composer
On this page you can find all versions of the php package rgarman/sdk-stats. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sdk-stats
Stats.com SDK
About
The sdk-stats package is an Software Development Kit for various stats.com API endpoints.
The way this SDK works is by the user customising the endpoints to use and assign their own names to them for easier and more efficient experience for the developer
Installation
Require the rgarman/sdk-stats package in your composer.json and update your dependencies:
Creating a Client:
I would recommend that an assoc array containing your login credentials is created, for ease later. This also will aid in creating multiple different instances with different API's simultaniously Create an instance of the ClientCore() class
Adding Resources
To add a Resource to use, simply call the AddResource() method from the ClientCore and pass an instance of either a Route, or Cache
The parameters to which are: the name, and the chosen instance Route parameters:
- Endpoint (String)
- Parameters (Array)
- Config Credentials
Using the Resources
Using the name you assigned the resource, simply use it as a property and use any of the below listed functions
Function List
Route Instance:
get( $Parameters (Array/String) )
makes a call to the current API endpoint selected using the Parameters provided as an array or string
Returns the response from the API as an array
getAndCache ( $Parameters (Array/String) )
Basically the same functionality as get, except for the fact that a cache will be createdin the form of raw JSON
Returns the response from the API as an array (In addition to the cache)
setMethod( $Method (String) )
Sets the type of HTTP protocol to use e.g. GET, POST, PUT etc. Accepts all 7 types
setBase( $Base (String) )
Sets the Base URI of the API to use, so other API's can be used within the same SDK!
- -
Cache Instance:
get( $Cache (String) )
Retreives the given cache, use "*" to get the names of all stored cached data
See the Example for more