1. Go to this page and download the library: Download mwspace/packlink-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/ */
use MwSpace\Packlink\Models\Stat;
$states = Stat::all(); // get all shipments states
return json_encode($states); // decode Stat object class to json
use MwSpace\Packlink\Models\Carrier;
private $packages = [[]];
$carriers = Carrier::ship($this->packages);
$carriers->from(array( // get prices for parcels by zip code from => to
'country' => 'IT',
'zip' => '20900'
));
$carriers->to(array(
'country' => 'IT',
'zip' => '06073'
));
return json_encode($carriers->all()); // decode Carrier object class to json
use MwSpace\Packlink\Models\Carrier;
private $packages = [[]];
$carriers = Carrier::ship($this->packages);
return json_encode($carriers->find('YOUR_CARRIER_ID')); // decode Carrier object class to json
use MwSpace\Packlink\Models\Carrier;
$carriers = Carrier::quote(8.5);
$carriers->from(array( // get prices for parcels by zip code from => to
'country' => 'IT',
'zip' => '20900'
));
$carriers->to(array(
'country' => 'IT',
'zip' => '06073'
));
return json_encode($carriers->all()); // decode Carrier object class to json
use MwSpace\Packlink\Models\PostalZone;
$postalzones = PostalZone::all(); // get all postal zones with default filter [all]
return json_encode($postalzones); // decode PostalZone object class to json
use MwSpace\Packlink\Models\PostalCode;
$postalcodes = PostalCode::all(); // get all postal codes with default filter [all]
return json_encode($postalcodes); // decode PostalCode object class to json
use MwSpace\Packlink\Models\PostalCode;
$postalcode = PostalCode::get('YOUR_ZIP_CODE'); // get postal code by query filter [q]
return json_encode($postalcode); // decode PostalCode object class to json
use MwSpace\Packlink\Models\PostalCode;
$postalcode = PostalCode::exists('YOUR_ZIP_CODE'); // get postal code by query filter [q]
return is_bool($postalcode); // check if exists postal code
use MwSpace\Packlink\Models\Shipment;
$shipments = Shipment::all(); // get all shipments with default filter [all]
return json_encode($shipments); // decode Shipment object class to json
use MwSpace\Packlink\Models\Shipment;
$shipment = Shipment::find('YOUR_SHIPMENT_ID'); // find shipment by id
return json_encode($shipment); // decode Shipment object class to json
use MwSpace\Packlink\Models\Shipment;
$shipment = Shipment::where('status','READY_TO_PURCHASE');
return json_encode($shipment); // decode Shipment object class to json
use MwSpace\Packlink\Models\Shipment;
private $shipment = [];
$shipment = Shipment::create($shipment); // create new Shipment by Model Class
return json_encode($shipment); // decode Shipment object class to json
use MwSpace\Packlink\Shipment;
$shipment = Shipment::find('YOUR_SHIPMENT_ID'); // find shipment by id
$update = $shipment->update([
"content" => "New awesome t-shirt" // update shipping data
]);
return json_encode($update); // decode Shipment object class to json
use MwSpace\Packlink\Models\Shipment;
$shipment = Shipment::find('YOUR_SHIPMENT_ID'); // find shipment by id
$shipment->delete(); // delete shipping record by id if draft
use MwSpace\Packlink\Warehouse;
$warehouses = Warehouse::all(); // get all warehouses
return json_encode($warehouses); // decode Warehouse object class to json
use MwSpace\Packlink\Warehouse;
$warehouse = Warehouse::find('YOUR_WAREHOUSE_ID'); // find warehouse by id
return json_encode($warehouse); // decode Warehouse object class to json
use MwSpace\Packlink\Warehouse;
private $warehouse = [];
$warehouse = Warehouse::create($warehouse); // create new Warehouse by Model Class
return json_encode($warehouse); // decode Warehouse object class to json
use MwSpace\Packlink\Warehouse;
$warehouse = Warehouse::find('YOUR_WAREHOUSE_ID'); // find warehouse by id
$update = $warehouse->update([
"alias" => "New awesome t-shirt" // update warehouse data
]);
return json_encode($update); // decode Warehouse object class to json
use MwSpace\Packlink\Warehouse;
$warehouse = Warehouse::find('YOUR_WAREHOUSE_ID'); // find warehouse by id
$warehouse->setDefault(); // set default warehouse record
use MwSpace\Packlink\Warehouse;
$warehouse = Warehouse::find('YOUR_WAREHOUSE_ID'); // find warehouse by id
$warehouse->delete(); // delete warehouse record by id if > 1
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.