PHP code example of orderchamp / orderchamp-api-php

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

    

orderchamp / orderchamp-api-php example snippets


use Orderchamp\Api\OrderchampApiClient;

$client = new OrderchampApiClient([
    'client_id'     => 'your_client_id',
    'client_secret' => 'your_client_secret',
]);

// Redirect the user to this url for authorization
$authorizationUrl = $client->authorizationUrl($this->config['scopes'], 'redirect_url_goes_here');

// We redirect the user back to your redirect url
// Call the method with the $_GET parameters and we'll fetch you a token
$token = $client->requestToken($request->all());

// Persist this token and use it moving forward
$client->setAccessToken($token);
$response = $client->graphql('{ account { id name } }');

dd($response);

composer