PHP code example of crakter / bringapi

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

    

crakter / bringapi example snippets


use Crakter\BringApi\Entity\TrackingEntity;
use Crakter\BringApi\Clients\Authorization;
use Crakter\BringApi\Clients\Tracking\TrackingEndpoint;

$trackingEntity = (new TrackingEntity)->set(['q' => 'TESTPACKAGE-AT-PICKUPPOINT']); // Can be used like this
//$trackingEntity = (new TrackingEntity)->setQ('TESTPACKAGE-AT-PICKUPPOINT'); // Can also be used like this
/* And like this
$trackingEntity = (new TrackingEntity);
$trackingEntity->q = 'TESTPACKAGE-AT-PICKUPPOINT';
*/
$authorizationModule = (new Authorization)
    ->setApiKey('1234abc-abcd-1234-5678-abcd1234abcd')
    ->setClientId('[email protected]')
    ->setClientUrl('http://example.com');

$tracking = (new TrackingEndpoint)
    ->setAuthorizationModule($authorizationModule)
    ->setApiEntity($trackingEntity)
    ->send();
print_r($tracking->toArray());

vendor/bin/sami.php -n render SamiConfig.php

"vendor/bin/sami.php.bat" -n render SamiConfig.php

cd examples/
php BookAndPickupShipment.php
php PostalCode.php <numberOfPostalCode>
php ShippingGuideAll.php <fromPostalCode> <toPostalCode>
php Tracking.php <query>
php Reports.php <reportId>