Yurtiçi Kargo php api entegrasyonu
You can install the bindings via Composer. Run the following command:
composer require smberg/yurtici-kargo
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the YurticiKargoBootstrap.php
file.
require_once('/path/to/yurtici-kargo-php/YurticiKargoBootstrap.php');
<?php
require_once "../vendor/autoload.php";
$request = new YurticiKargo\Request("test");
$request->setUser("YKTEST", "YK");
$shipmentDetails = array(
"receiverCustName" => "Berkay Gümüştekin",
"receiverAddress" => "Test Mah. Deneme Sk. No:3",
"receiverPhone1" => "05555555555",
"invoiceKey" => "SBG".YurticiKargo\Request::generateKey(17),
"cargoKey" => "SBG".YurticiKargo\Request::generateKey(10)
);
$shipment = new YurticiKargo\Shipment();
$shipment->setShipmentDetails($shipmentDetails);
$createShipment = $request->createShipment($shipment);
echo '<pre>';
print_r($createShipment);
echo '</pre>';
<?php
require_once "../vendor/autoload.php";
$request = new YurticiKargo\Request();
$request->setUser("YKTEST", "YK")->init("test");
$queryShipment = $request->queryShipment("SBG5448C616D8");
echo '<pre>';
print_r($queryShipment->getResultData());
echo '</pre>';