PHP code example of dan-rogers / shiptheory-php-client

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

    

dan-rogers / shiptheory-php-client example snippets


 declare(strict_types=1);

tion\CredentialsAccessToken;

$token = new CredentialsAccessToken('[email protected]', 'password');

 declare(strict_types=1);

tion\PermanentAccessToken;

$token = new PermanentAccessToken('ABC12345678');

 declare(strict_types=1);

olog\Level;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use ShiptheoryClient\Authorization\CredentialsAccessToken;
use ShiptheoryClient\ShiptheoryClient;

$client = new Client();
$token =  new CredentialsAccessToken('[email protected]', 'password');

$log = new Logger('Shiptheory');
$handler = new StreamHandler('/path/to/your/logfile.log', Level::Debug);
$handler->setFormatter(new LineFormatter(null, null, true, true));
$log->pushHandler($handler);

$shiptheory = new ShiptheoryClient($client, $token, $log, 'partner_tag');

$res = $shiptheory->listTags();
var_dump($res->getBody()->getContents());

$client = new ShiptheoryClient($client, $token, $log, 'partner_tag');

composer