PHP code example of neoson / easystore-api

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

    

neoson / easystore-api example snippets


\EasyStore\Options::setOptions([
    'shop' => 'YOUR SHOP NAME', // rotected endpoint
    'version' => '1.0', // default value
    'timeout' => 15, // default value
]);

$client = new \EasyStore\Client();

$client->get($endpoint, $parameter = [])

$client->post($endpoint, $body)

$client->put($endpoint, $body)

$client->delete($endpoint, $body = [])

// setup re\Options::setOptions([
    'shop' => 'YOUR SHOP NAME', 
    'client_id' => 'YOUR CLIENT ID',
    'scopes' => 'YOUR SCOPES', 
    'redirect_uri' => 'YOUR REDIRECT URL', 
]);

$requestUrl = $client->buildAuthUrl();

// if you are using laravel
return response()->redirect($requestUrl);

// setup re\Options::setOptions([
    'shop' => 'YOUR SHOP NAME', 
    'client_id' => 'YOUR CLIENT ID',
    'client_secret' => 'YOUR CLIENT SECRET',
]);

$accessToken = $client->getAccessToken();
//store this access token somewhere