PHP code example of semivan / getcourse-api-client

1. Go to this page and download the library: Download semivan/getcourse-api-client 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/ */

    

semivan / getcourse-api-client example snippets


$client  = new \Getcourse\GetcourseClient($account, $secretKey);
$manager = new \Getcourse\GetcourseManager($client);

$exportId = $manager
    ->exportUsers()
    ->setStatus('active')
    ->getExportId();

$users = $manager
    ->exportUsers()
    ->export($exportId);

$exportId = $manager
    ->exportDeals()
    ->setCreatedAtPeriod('2020-08-01')
    ->getExportId();

$deals = $manager
    ->exportDeals()
    ->export($exportId);

$user = $manager->createUser()
    ->setEmail('[email protected]')
    ->setFirstName('FirstName')
    ->setLastName('LastName')
    ->setPhone('+77777777777')
    ->setCountry('Country')
    ->setCity('City')
    ->setRefresh(true)
    ->addGroup('group_name');

$response = $user->save();

$deal = $manager->createDeal()
    ->setUser($user)
    ->setNumber('123XXX')
    ->setOfferCode('offer_code')
    ->setStatus(\Getcourse\Constants::DEAL_STATUS_NEW)
    ->setProductTitle('prod 01')
    ->setCost(1000)
    ->setIsPaid(true);

$response = $deal->save();