deliverea / deliverea-php
There is no license information available for the latest version (0.0.25) of this package.
This package's canonical repository appears to be gone and the package has been frozen as a result.
0.0.25
2018-07-23 08:34 UTC
Requires
- php: ^5.4
- dev-master
- 0.0.25
- 0.0.24
- 0.0.23
- 0.0.22
- 0.0.21
- 0.0.20
- 0.0.19
- 0.0.18
- 0.0.17
- 0.0.16
- 0.0.15
- 0.0.14
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-DSD-000--balclis
- dev-shipment-drop-point-key
- dev-DSD-618-pro-service-CA
- dev-DSD-586
- dev-DSD-336-Export-csv
- dev-DSD-341-Clients-area
- dev-DSD-367-add-to-php-library
- dev-DSD-337-Drop-point-endpoint
- dev-DSD-124-Error
- dev-DSD-81-Api-Errors
This package is not auto-updated.
Last update: 2024-01-20 14:20:55 UTC
README
Deliverea PHP API Library
This is the official library used to integrate with Deliverea's API, it is currently in beta stages so if there are any bugs or fixes you would like to contribute please do so with Pull Requests.
Compatibility:
- Deliverea v1: https://www.deliverea.com/es/api/
Installation
composer require deliverea/deliverea-php 0.0.9
Methods
- Get Client Carriers
- Get Client Services
- Get Shipments Rates
- Get Shipment Time Arrival Estimation
- Get Service Info
- New Shipment
- Get Collection Cutoff Hour
- Get Drop Points
- New Collection
- Get Shipment Label
- Get Shipment
- Get Shipments
- Get Shipment Tracking
Exceptions
Wrap all requests with a try catch of these exceptions or simply a standard \Exception
- \Deliverea\Exception\CurlException
- \Deliverea\Exception\ErrorResponseException
- \Deliverea\Exception\UnexpectedResponseException
####Example:
try {
$deliverea->newShipment($shipment, 32, $address);
} catch (\Deliverea\Exception\CurlException $e) {
} catch (\Deliverea\Exception\ErrorResponseException $e) {
} catch (\Deliverea\Exception\UnexpectedResponseException $e) {
}
Get Client Carriers
$delivereaClient->getClientCarriers();
Get Client Services
All parameters in this method are optional, status can be 0, 1 or null.
$delivereaClient->getClientServices(
'Carrier Code',
'Service Code',
'Service Region',
'Service Type',
'Status'
);
Get Shipments Rates
$delivereaClient->getShipmentsRates(
new CountryCode('ES'),
new ZipCode('08018'),
new CountryCode('ES'),
new ZipCode('07800'),
new ParcelDimensions(2.0,1.0,1.0,1.0),
new ParcelWeight(1.5)
);
Get Shipment Time Arrival Estimation
$delivereaClient->getShipmentTimeArrivalEstimation(
new CountryCode('ES'),
new ZipCode('08018'),
new CountryCode('ES'),
new ZipCode('07800'),
new \DateTime()
);
Get Service Info
$delivereaClient->getServiceInfo(
'Carrier Code',
'Service Code',
'From Country Code',
'From Zip Code',
'To Country Code',
'To Zip Code'
);
New Shipment
// Create API Client
$deliverea = new \Deliverea\Deliverea('apiuser', 'apisecret');
// Enable Sandbox
$deliverea->setSandbox(true);
// Create shipment
$shipment = new \Deliverea\Model\Shipment(1, substr(md5(strtotime('now')), 0, 14), new \DateTime(), 'custom',
'ovirtual', 'ovirtual-servicio-19');
$fromAddress = new Address(
'Full Name',
'Address',
'City',
'Zip Code',
'Country Code',
'Phone'
);
$toAddress = new \Deliverea\Model\Address(
'Full name',
'Address',
'City',
'Zip Code',
'Country Code',
'Phone'
);
$shipment = $deliverea->newShipment($shipment, $fromAddress, $toAddress);
To add carrier specific parameters you can assign it to the object itself.
$shipment->parcel_type = "DOCUMENTS";
Get Collection Cutoff Hour
$cutoffHour = $this->delivereaClient->getCollectionCutoffHour([
'zip_code' => '12345',
'country_code' => 'ES',
'service_code' => 'ovirtual-servicio-19',
'carrier_code' => 'ovirtual'
]);
Get Drop Points
$deliverea->getDropPoints([
'country_code' => 'ES',
'zip_code' => '08018',
'carrier_code' => 'mondialRelay',
]);
New Collection
// Create API Client
$deliverea = new \Deliverea\Deliverea('apiuser', 'apisecret');
// Create collection
$collection = new \Deliverea\Model\Collection(substr(md5(strtotime('now')), 0, 14), new \DateTime(),
'ovirtual', 'ovirtual-servicio-19', '11:00', '16:00');
$fromAddress = new Address(
'Full Name',
'Address',
'City',
'Zip Code',
'Country Code',
'Phone'
);
$toAddress = new \Deliverea\Model\Address(
'Full name',
'Address',
'City',
'Zip Code',
'Country Code',
'Phone'
);
$collection = $deliverea->newCollection($collection, $fromAddress, $toAddress);
Get Shipment Label
$deliverea->getShipmentLabel('dlvrref');
Get Shipment
$deliverea->getShipment('dlvrref');
Get the Shipments via filters in the API (not including Tracking Events)
$deliverea->getShipments([
'filter_shipping_dlvr_ref' => 'dlvrref'
...
]);
Get Shipment Tracking
$deliverea->getShipmentTracking('dlvrref');