PHP code example of robert430404 / mrp-php-sdk

1. Go to this page and download the library: Download robert430404/mrp-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

robert430404 / mrp-php-sdk example snippets



     
use mrpsdk\endpoints\points\PointsEndpoint;
     
class YourClass
{
    /**
     * @var PointsEndpoint
     */
    protected $pointsEndpoint;
    
    /**
     * YourClass constructor.
     */
    public function __construct()
    {
        $apiKey = 'XXXXXXX-XXXX-XXXXXX-XXXXXXXXXX';
             
        $this->pointsEndpoint = new PointsEndpoint($apiKey);
    }
    
    /**
     * Returns Data From The MRP API In Object Form From JSON
     * 
     * @return mixed
     */
    public function returnData()
    {
        $data = $this->pointsEndpoint      // Your Object
                     ->setScheduleId(1000) // Builds URL
                     ->setClassId(1000)    // Builds URL
                     ->getRequest();       // Sends Request And Returns Data
            
        return $data;
    }
}