1. Go to this page and download the library: Download tcgunel/omniship-aras 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/ */
tcgunel / omniship-aras example snippets
use Omniship\Omniship;
$carrier = Omniship::create('Aras');
$carrier->initialize([
'username' => 'your-username',
'password' => 'your-password',
'testMode' => true, // false for production
'senderAccountAddressId' => '', // optional
]);
use Omniship\Common\Address;
use Omniship\Common\Package;
use Omniship\Common\Enum\PaymentType;
$response = $carrier->createShipment([
'shipTo' => new Address(
name: 'Ahmet Yilmaz',
street1: 'Ataturk Cad. No:1',
city: 'Istanbul',
district: 'Kadikoy',
phone: '05551234567',
),
'packages' => [
new Package(
weight: 1.5,
length: 30,
width: 20,
height: 15,
description: 'Elektronik urun',
),
],
'integrationCode' => 'ORD-001', // >getMessage(); // error description
echo $response->getCode(); // Aras result code
}
'barcodes' => ['1234567801', '1234567802'],
// Generate labels using default template
$html = $carrier->generateLabels([
'shipFrom' => $shipFrom,
'shipTo' => $shipTo,
'packages' => $packages,
'integrationCode' => '12345678',
'paymentType' => PaymentType::SENDER,
'cashOnDelivery' => false,
]);
// Output or save the HTML
file_put_contents('labels.html', $html);