Download the PHP package reganface/rgp without Composer
On this page you can find all versions of the php package reganface/rgp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download reganface/rgp
More information about reganface/rgp
Files in reganface/rgp
Package rgp
Short Description PHP library for accessing the RGP API
License GPL-3.0-or-later
Homepage https://github.com/reganface/RGP-API
Informations about the package rgp
Rock Gym Pro API
Rock Gym Pro has released a basic API as of December 2019. This PHP class aims to make it easy to access all available endpoints that have been provided. RGP has made it clear that future development will be dependent on community interest and usage, so get coding! If there is some functionality you'd like to see added to the API, let RGP support know, as this will help guide development.
API Documentation
You can view RGP's documentation of their API here: https://api.rockgympro.com
API Keys
You will need to generate an API key before being able to access the API. This Google Doc from RGP has instructions on how to generate your key for both cloud and locally hosted servers.
Version 1.0.0 of This Library
The scope of this library has been reduced to provide just the basic wrapper and some small tweaks on the response structure. Previously, there were separate methods for each endpoint of the API. There were multiple changes in the API that each broke the library, so endpoint specific methods were removed in favor of a more generlized approach using the new get()
method.
Installation
There are two ways to use this library. You can install it as a dependency with Composer, or you can download RGP.php from this repository and include it in your code.
Composer
Include composer's autoload file at the top of your project to load all of your dependencies.
Download
Save RGP.php to your project folder and include it in your project.
cURL
This class requires curl to be installed and enabled on the version of PHP that you are using. PHP will throw errors if curl is not accessible.
Basic Usage
When instantiating the class, you just need to include your api username and api key. Exceptions will be thrown on any errors, so make sure to keep code inside a try/catch block.
The structure of the data returned by get()
will differ slightly from what RGP returns if you were to access the API directly. This is done to keep the meta data of the response separate from the data you requested. The structure looks like this:
If you would prefer to have the data exactly as the API returns, you can use get_raw()
instead.
Example
Methods
get()
Returns data from the API with a slightly altered data structure as seen below:
path\ This is the path of the API endpoint. The list of all current endpoints is available at https://api.rockgympro.com. Note: do not include "/v1" in the path.
params\ An associative array of any query paramaters you want to include with the call.
get_raw()
This method is identical to get()
except that it will return the data exactly how the API returns it.
test()
Tests the connection to the API. Returns true if a connections can be made successfully.
All versions of rgp with dependencies
ext-curl Version *