PHPackages                             kasim.yilmaz/pts-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. kasim.yilmaz/pts-api

ActiveLibrary[API Development](/categories/api)

kasim.yilmaz/pts-api
====================

PTS Worldwide Express Api Integration Package

038PHP

Since Jul 9Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ksmylmz/pts-api)[ Packagist](https://packagist.org/packages/kasim.yilmaz/pts-api)[ RSS](/packages/kasimyilmaz-pts-api/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PTS Cargo Api Integration Package
=================================

[](#pts-cargo-api-integration-package)

This procject contains main methots which is soap based PTS Api. PTS wsdl scheme was used during creating models.

> It is important appliying changes it exist at wsdl scheme. Because any changing on scheme will effect parameters sorting.

1- Installation
---------------

[](#1--installation)

it is compatible any project that follows psr-4 standards

### A-install with composer

[](#a-install-with-composer)

```
 composer require kasim.yilmaz/pts-api

```

### B-install without composer

[](#b-install-without-composer)

Download project to where you include

```
require vendor/autoload.php

```

2- Initialize
-------------

[](#2--initialize)

We need setting credentials before init PTS Api object

The credentials will provide from PTS;

```
use ksmylmz\ptsapi\PtsApi;

use ksmylmz\ptsapi\Config;

$config = new Config();

$config->setUsername("*******");
$config->setPassword("*******");
$config->setWsdl_url("********");

$ptsApi = new PtsApi($config);
```

3- Response Handling
====================

[](#3--response-handling)

All Method of PtsApi Object Return with type of

```
use ksmylmz\ptsapi\model\Response
```

You can check the response been succes or fault status via Status parameter. In addition, Response Object contains request and response xml values.

For Eg.

```
$response = $ptsApi->GetConsignment("1234567", "2222222222");
if($response->status)
{
   var_dump($response->body);
}else
{
   echo $response->error;
}

echo $response->lastRequest;
echo $response->lastResponse;
```

4- Create Shipment Request
--------------------------

[](#4--create-shipment-request)

```
use ksmylmz\ptsapi\enum\PaymentType;
use ksmylmz\ptsapi\enum\ServiceTypes;
use ksmylmz\ptsapi\model\Dimension;
use ksmylmz\ptsapi\model\Shipment;
use ksmylmz\ptsapi\model\ShipmentItem;
use ksmylmz\ptsapi\model\UpdateInvoice;

$shipment = new Shipment();
/**
 *  ptsno  = 0 means creating new shipment
 *  setting ptsno with  existing any ptsno, it means
 *  update shipment
 */
$shipment->ptsno = 0;
$shipment->servis  = ServiceTypes::Eco;
$shipment->yetkili = "receiver name";
$shipment->sirketadi = "receiver company A.Ş.";
$shipment->adres = "test test adres test street no.1";
$shipment->sehir = "AMSTERDAM";
/*
 state code if exist
 $shipment->eyalet = "LA";
 */
$shipment->postakodu = "11111";
$shipment->ulkekodu = "NL";
$shipment->toplamkg = 1;
/**
 * Customer refferance or E-commerce
 * order no
 */
$shipment->siparisno = "abc124";
$shipment->malcinsi = "Dress";
$shipment->toplamadet = 10;
$shipment->toplamdeger = 100;
$shipment->parabirimi = "EUR";

$item  = new ShipmentItem();
$item->aciklama = "Dress";
$item->birim = "PCS";
$item->birimfiyat = 10;
$item->miktar = 10;
/**
 *  12 digit HS code for conforming to Turkish norms
 */
$item->gtip = "621143000000";

$shipment->fatura = [
    $item
];
$shipment->faturano = "abc20220202";
/** yyyy-mm-dd */
$shipment->faturatarihi = "2022-01-01";

$shipment->earsivpdf = "http://invoice-pdf-url/invoice.pdf";

/**getting label with creating shipment request */
$shipment->etiket = 1;

$box1 = new Dimension();
$box1->en = 10;
$box1->boy = 10;
$box1->yukseklik = 10;
$box1->kg = 1;

$box2 = new Dimension();
$box2->en = 10;
$box2->boy = 10;
$box2->yukseklik = 10;
$box2->kg = 3;

$shipment->ebat = [
    $box1, $box2
];

$shipment->payType = PaymentType::PREPAID;

$shipment->gumruktipi = CustomsType::DDP;

$ptsApi->addShipment($shipment);
```

5- Creating Shipment With Pickup Request
----------------------------------------

[](#5--creating-shipment-with-pickup-request)

> This method needs special permission

All parameters are the same as in the shipment model except the parameters marked below

```
use ksmylmz\ptsapi\model\ShipmentWithPickup;

$shipment = new ShipmentWithPickup();
/***difference parameters from shipment **/

$shipment->gonderici_unvan ="sender compnay a.ş";
$shipment->gonderici_adres = "test sender adres test street no 1";
$shipment->gonderici_sehir = "ISTANBUL";
$shipment->gonderici_email = "sender@sender.com";
$shipment->gonderici_postakodu="341111";
$shipment->gonderici_telefon ="+905500000000";
$shipment->gonderici_ulkekodu ="TR";

$ptsApi->addShipmentWithPickup($shipment);
```

6- Tracking Request
-------------------

[](#6--tracking-request)

You may passing customer refferance or PTS refferance

```
use ksmylmz\ptsapi\enum\Language;

$ptsApi->Tracking("customerRef", "PTSRef", Language::ENGLISH);
```

7- Get Label Request
--------------------

[](#7--get-label-request)

You may passing customer refferance or PTS refferance

label code parameter value 1 returns with pts label. For last mile label codes you need PTS permission for each label code.

The label size is 4X6 inch thermal label; In generaly, PDF format.

```
$ptsApi->GetLabel("1234567", "222222222", 1);
```

8- Get Consignment Request
--------------------------

[](#8--get-consignment-request)

You may passing customer refferance or PTS refferance

It returns A4 size and PDF format

```
$ptsApi->GetConsignment("1234567", "222222222");
```

9- Update Invoice Information Request
-------------------------------------

[](#9--update-invoice-information-request)

Sometimes, Your invoice may not be ready while creating shipment. In this cases you may update shipment invoice informations.

> For using that method, shipment must be unprocessed as pysicaly

```
$updateInvoice = new UpdateInvoice();
$updateInvoice->ptsno = "22222222222";
$updateInvoice->siparisno = "abc123456";

$updateInvoice->faturano = "abc20220202";
/** yyyy-mm-dd */
$updateInvoice->faturatarihi = "2022-01-01";

$updateInvoice->arsivpdf = "http://invoice-pdf-url/invoice.pdf";

$ptsApi->updateInvoice($updateInvoice);
```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26962737?v=4)[Kasım YILMAZ](/maintainers/ksmylmz)[@ksmylmz](https://github.com/ksmylmz)

---

Top Contributors

[![kasimyilmazpts](https://avatars.githubusercontent.com/u/192598339?v=4)](https://github.com/kasimyilmazpts "kasimyilmazpts (11 commits)")[![ksmylmz](https://avatars.githubusercontent.com/u/26962737?v=4)](https://github.com/ksmylmz "ksmylmz (1 commits)")

### Embed Badge

![Health badge](/badges/kasimyilmaz-pts-api/health.svg)

```
[![Health](https://phpackages.com/badges/kasimyilmaz-pts-api/health.svg)](https://phpackages.com/packages/kasimyilmaz-pts-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
