Skip to content

smberg/yurtici-kargo-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yurtiçi Kargo PHP

Yurtiçi Kargo php api entegrasyonu

Installation

Composer

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');

Manual Installation

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');

Create a shipment request

<?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>';

Query cargo status

<?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>';