PHPackages                             tigusigalpa/shiptime-php - 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. tigusigalpa/shiptime-php

ActiveLibrary[API Development](/categories/api)

tigusigalpa/shiptime-php
========================

Modern PHP/Laravel client library for the ShipTime REST API

v1.0.0(4mo ago)61MITPHPPHP ^8.1CI failing

Since Feb 17Pushed 4mo agoCompare

[ Source](https://github.com/tigusigalpa/shiptime-php)[ Packagist](https://packagist.org/packages/tigusigalpa/shiptime-php)[ RSS](/packages/tigusigalpa-shiptime-php/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

ShipTime PHP/Laravel Client
===========================

[](#shiptime-phplaravel-client)

[![ShipTime PHP SDK](https://private-user-images.githubusercontent.com/2721390/550714904-71e6d9ed-ab0d-4f4c-b8e4-bf6ec26c017a.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODI2NzI3ODQsIm5iZiI6MTc4MjY3MjQ4NCwicGF0aCI6Ii8yNzIxMzkwLzU1MDcxNDkwNC03MWU2ZDllZC1hYjBkLTRmNGMtYjhlNC1iZjZlYzI2YzAxN2EuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDYyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA2MjhUMTg0ODA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDQ0NWRiNjE2YTk3Y2JlNWJlOTQ1NTA4MjNjNmZkZmExZjk3NTNjZTRiMjlhZjVmMmJlYzEyNjEzZDJlZDk1MSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGanBlZyJ9.nX_gRH3ZKJJURUKUJq-oSV6fYgk-O1ZasytkGP6-cVk)](https://private-user-images.githubusercontent.com/2721390/550714904-71e6d9ed-ab0d-4f4c-b8e4-bf6ec26c017a.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODI2NzI3ODQsIm5iZiI6MTc4MjY3MjQ4NCwicGF0aCI6Ii8yNzIxMzkwLzU1MDcxNDkwNC03MWU2ZDllZC1hYjBkLTRmNGMtYjhlNC1iZjZlYzI2YzAxN2EuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDYyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA2MjhUMTg0ODA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDQ0NWRiNjE2YTk3Y2JlNWJlOTQ1NTA4MjNjNmZkZmExZjk3NTNjZTRiMjlhZjVmMmJlYzEyNjEzZDJlZDk1MSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGanBlZyJ9.nX_gRH3ZKJJURUKUJq-oSV6fYgk-O1ZasytkGP6-cVk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f1afddfa2d7b59d608d938b23c2584cb065ffddae50f41c810c2968a34033367/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74696775736967616c70612f7368697074696d652d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tigusigalpa/shiptime-php)[![License](https://camo.githubusercontent.com/b5c2e64544dd13e1646a2c6dfc4bb834869f535dc2b7974e708fa9665fe9fc24/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f74696775736967616c70612f7368697074696d652d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tigusigalpa/shiptime-php)

A modern, robust, and well-documented PHP/Laravel client library for the [ShipTime REST API](https://restapi.shiptime.com/doc/index.html). Built with modern PHP 8.1+ features including strict typing, enums, and readonly properties.

Features
--------

[](#features)

- 🚀 **Modern PHP 8.1+** - Leverages the latest PHP features
- 🎯 **Strict Typing** - Full type safety with scalar types and return types
- 📦 **Complete API Coverage** - All public ShipTime API endpoints
- 🔧 **Laravel Integration** - Service provider for seamless Laravel integration
- 🛡️ **Robust Error Handling** - Specific exceptions for different error types
- 📝 **Comprehensive Documentation** - Fully documented with PHPDoc
- ✅ **Well Tested** - Comprehensive test suite
- 🎨 **Clean Architecture** - Service-oriented design with DTOs

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 9.x, 10.x, 11.x, or 12.x (for Laravel integration)
- Guzzle HTTP client 7.x

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require tigusigalpa/shiptime-php
```

### Laravel Installation

[](#laravel-installation)

The package will automatically register its service provider.

Publish the configuration file:

```
php artisan vendor:publish --tag=shiptime-config
```

Add your ShipTime API credentials to your `.env` file:

```
SHIPTIME_API_KEY=your_api_key
SHIPTIME_API_SECRET=your_api_secret
```

Usage
-----

[](#usage)

### Standalone PHP Usage

[](#standalone-php-usage)

```
use Tigusigalpa\ShipTime\ShipTime;

$shiptime = new ShipTime(
    apiKey: 'your_api_key',
    apiSecret: 'your_api_secret'
);

// Get shipping rates
$rates = $shiptime->rates()->getRates($rateRequest);

// Create a shipment
$shipment = $shiptime->shipments()->createShipment($shipRequest);

// Track a shipment
$tracking = $shiptime->track()->track($shipmentId);
```

### Laravel Usage

[](#laravel-usage)

Inject the `ShipTime` client via dependency injection:

```
use Tigusigalpa\ShipTime\ShipTime;

class ShippingController extends Controller
{
    public function __construct(
        private ShipTime $shiptime
    ) {}

    public function getRates(Request $request)
    {
        $rates = $this->shiptime->rates()->getRates($rateRequest);

        return response()->json($rates);
    }
}
```

Or use the facade:

```
use Tigusigalpa\ShipTime\Facades\ShipTime;

$rates = ShipTime::rates()->getRates($rateRequest);
```

API Reference
-------------

[](#api-reference)

### Orders

[](#orders)

Create and manage preliminary shipment orders.

#### Get Orders

[](#get-orders)

```
use Tigusigalpa\ShipTime\ShipTime;

$shiptime = new ShipTime($apiKey, $apiSecret);

// Get paginated list of orders
$orders = $shiptime->orders()->getOrders(
    page: 0,
    size: 10,
    status: 'PENDING',
    orderDate: '2024-01-15'
);

foreach ($orders->content as $order) {
    echo "Order ID: {$order['orderId']}\n";
}
```

#### Create Order

[](#create-order)

```
use Tigusigalpa\ShipTime\DTOs\OrderRequest;
use Tigusigalpa\ShipTime\DTOs\ShipTo;
use Tigusigalpa\ShipTime\DTOs\Package;
use Tigusigalpa\ShipTime\DTOs\Dimensions;

$shipTo = new ShipTo(
    streetAddress: '123 Main St',
    city: 'New York',
    state: 'NY',
    postalCode: '10001',
    countryCode: 'US',
    companyName: 'Acme Corp',
    attention: 'John Doe',
    phone: '555-1234'
);

$package = new Package(
    weight: 5.5,
    dimensions: new Dimensions(length: 12, width: 8, height: 6),
    type: 'PACKAGE'
);

$orderRequest = new OrderRequest(
    orderNumber: 'ORD-12345',
    shipTo: $shipTo,
    unitOfMeasurement: 'IMPERIAL',
    packages: [$package]
);

$response = $shiptime->orders()->createOrder($orderRequest);
echo "Order created with ID: {$response->orderId}\n";
```

#### Cancel Order

[](#cancel-order)

```
$cancelResponse = $shiptime->orders()->cancelOrder(orderId: 12345);

if ($cancelResponse->success) {
    echo "Order cancelled successfully\n";
}
```

### Rates

[](#rates)

Get shipping rates for your shipments.

```
use Tigusigalpa\ShipTime\DTOs\RateRequest;
use Tigusigalpa\ShipTime\DTOs\Address;
use Tigusigalpa\ShipTime\DTOs\LineItem;
use Tigusigalpa\ShipTime\Enums\PackageType;
use Tigusigalpa\ShipTime\Enums\UnitOfMeasurement;

$from = new Address(
    companyName: 'My Company',
    streetAddress: '123 Sender St',
    city: 'Los Angeles',
    countryCode: 'US',
    state: 'CA',
    postalCode: '90001',
    attention: 'Sender Name',
    phone: '555-0001'
);

$to = new Address(
    companyName: 'Customer Co',
    streetAddress: '456 Receiver Ave',
    city: 'New York',
    countryCode: 'US',
    state: 'NY',
    postalCode: '10001',
    attention: 'Receiver Name',
    phone: '555-0002'
);

$lineItem = new LineItem(
    length: 12.0,
    width: 8.0,
    height: 6.0,
    weight: 5.5
);

$rateRequest = new RateRequest(
    from: $from,
    to: $to,
    packageType: PackageType::PACKAGE,
    lineItems: [$lineItem],
    unitOfMeasurement: UnitOfMeasurement::IMPERIAL,
    shipDate: '2024-02-20'
);

$rateResponse = $shiptime->rates()->getRates($rateRequest);

foreach ($rateResponse->availableRates as $quote) {
    echo "Carrier: {$quote->carrierName}\n";
    echo "Service: {$quote->serviceName}\n";
    echo "Total: {$quote->totalCharge->currency->value} {$quote->totalCharge->amount}\n";
    echo "Transit Days: {$quote->transitDays}\n\n";
}
```

### Shipments

[](#shipments)

Create, retrieve, and manage shipments.

#### Create Shipment

[](#create-shipment)

```
use Tigusigalpa\ShipTime\DTOs\ShipRequest;

// Option 1: Using a quote ID from a previous rate request
$shipRequest = new ShipRequest(
    quoteId: 'quote_abc123'
);

// Option 2: Using rate request with carrier and service selection
$shipRequest = new ShipRequest(
    rateRequest: $rateRequest,
    carrierId: 'UPS',
    serviceId: 'UPS_GROUND',
    ref1: 'Reference 1',
    ref2: 'Reference 2'
);

$shipResponse = $shiptime->shipments()->createShipment($shipRequest);

echo "Shipment ID: {$shipResponse->shipId}\n";
echo "Tracking Number: {$shipResponse->trackingNumbers[0]}\n";
echo "Label URL: {$shipResponse->labelUrl}\n";
```

#### Get Shipments

[](#get-shipments)

```
$shipments = $shiptime->shipments()->getShipments(
    page: 0,
    size: 20,
    shipDate: '2024-02-15'
);

foreach ($shipments->content as $shipment) {
    echo "Shipment: {$shipment['shipId']}\n";
}
```

#### Get Shipment Details

[](#get-shipment-details)

```
$shipment = $shiptime->shipments()->getShipment(shipmentId: 12345);

echo "Status: {$shipment->status->value}\n";
echo "Carrier: {$shipment->carrierName}\n";
echo "Service: {$shipment->serviceName}\n";
```

#### Get Shipping Label (PDF)

[](#get-shipping-label-pdf)

```
$labelPdf = $shiptime->shipments()->getLabel(shipmentId: 12345);

// Save to file
file_put_contents('label.pdf', $labelPdf);

// Or send as download
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="shipping-label.pdf"');
echo $labelPdf;
```

#### Get Customs Invoice (PDF)

[](#get-customs-invoice-pdf)

```
$invoicePdf = $shiptime->shipments()->getCustomsInvoice(shipmentId: 12345);
file_put_contents('customs-invoice.pdf', $invoicePdf);
```

#### Cancel Shipment

[](#cancel-shipment)

```
$cancelResponse = $shiptime->shipments()->cancelShipment(shipmentId: 12345);

if ($cancelResponse->success) {
    echo "Shipment cancelled\n";
}
```

### Tracking

[](#tracking)

Track shipments and get delivery status.

```
$trackResponse = $shiptime->track()->track(
    shipmentId: 12345,
    includeTime: true
);

$tracking = $trackResponse->trackingRecord;

echo "Current Status: {$tracking->currentStatus->value}\n";

foreach ($tracking->history as $event) {
    echo "{$event->timestamp} - {$event->name} at {$event->location}\n";
}

// Proof of delivery
if ($tracking->podInfo) {
    echo "Signed by: {$tracking->podInfo->signedBy}\n";
    echo "Delivered at: {$tracking->podInfo->timestamp}\n";
}
```

### Pickups

[](#pickups)

Schedule and manage pickups.

#### Schedule Pickup

[](#schedule-pickup)

```
use Tigusigalpa\ShipTime\DTOs\PickupRequest;
use Tigusigalpa\ShipTime\DTOs\PickupDetail;
use Tigusigalpa\ShipTime\Enums\PickupLocation;

$pickupDetail = new PickupDetail(
    location: PickupLocation::FRONT_DOOR,
    pickupDate: '2024-02-20',
    readyTime: '09:00',
    closeTime: '17:00'
);

$pickupRequest = new PickupRequest(
    shipId: 12345,
    pickupDetail: $pickupDetail
);

$pickup = $shiptime->pickups()->schedulePickup($pickupRequest);

echo "Pickup scheduled: {$pickup->confirmationNumber}\n";
```

#### Get Pickups

[](#get-pickups)

```
$pickups = $shiptime->pickups()->getPickups(page: 0, size: 10);

foreach ($pickups->content as $pickup) {
    echo "Pickup ID: {$pickup['id']}\n";
}
```

#### Cancel Pickup

[](#cancel-pickup)

```
$response = $shiptime->pickups()->cancelPickup(pickupId: 'pickup123');

if ($response->success) {
    echo "Pickup cancelled\n";
}
```

#### Get Available Pickups for Shipment

[](#get-available-pickups-for-shipment)

```
$availablePickups = $shiptime->pickups()->getAvailablePickupsForShipment(
    shipmentId: 12345
);

if ($availablePickups->pickup) {
    echo "Available pickup: {$availablePickups->pickup->confirmationNumber}\n";
}
```

### Boxes

[](#boxes)

Get available box configurations.

```
$boxes = $shiptime->boxes()->getBoxes();

foreach ($boxes as $box) {
    echo "Box: {$box->name}\n";
    echo "Dimensions: {$box->length}x{$box->width}x{$box->height}\n";
    echo "Weight: {$box->weight}\n\n";
}
```

### Accounts

[](#accounts)

Get account information and available services.

```
$servicesResponse = $shiptime->accounts()->getAvailableServices();

foreach ($servicesResponse->carrierServices as $service) {
    echo "Carrier: {$service->carrierName}\n";
    echo "Service: {$service->serviceName}\n\n";
}
```

### Location

[](#location)

Lookup location information by postal code.

```
use Tigusigalpa\ShipTime\Enums\CountryCode;

$location = $shiptime->location()->lookup(
    countryCode: CountryCode::US,
    postalCode: '10001'
);

echo "City: {$location->city}\n";
echo "State: {$location->state}\n";
```

Error Handling
--------------

[](#error-handling)

The library provides specific exception classes for different error scenarios:

```
use Tigusigalpa\ShipTime\Exceptions\AuthenticationException;
use Tigusigalpa\ShipTime\Exceptions\ValidationException;
use Tigusigalpa\ShipTime\Exceptions\NotFoundException;
use Tigusigalpa\ShipTime\Exceptions\ForbiddenException;
use Tigusigalpa\ShipTime\Exceptions\ServerErrorException;
use Tigusigalpa\ShipTime\Exceptions\ShipTimeException;

try {
    $rates = $shiptime->rates()->getRates($rateRequest);
} catch (AuthenticationException $e) {
    // Invalid API credentials
    echo "Authentication failed: {$e->getMessage()}\n";
} catch (ValidationException $e) {
    // Invalid request data
    echo "Validation error: {$e->getMessage()}\n";
} catch (NotFoundException $e) {
    // Resource not found
    echo "Not found: {$e->getMessage()}\n";
} catch (ForbiddenException $e) {
    // Access forbidden
    echo "Forbidden: {$e->getMessage()}\n";
} catch (ServerErrorException $e) {
    // Server error (5xx)
    echo "Server error: {$e->getMessage()}\n";
} catch (ShipTimeException $e) {
    // Any other ShipTime API error
    echo "API error: {$e->getMessage()}\n";
}
```

International Shipments
-----------------------

[](#international-shipments)

For international shipments, you need to provide customs information:

```
use Tigusigalpa\ShipTime\DTOs\CustomsInvoice;
use Tigusigalpa\ShipTime\DTOs\DutiesAndTaxes;
use Tigusigalpa\ShipTime\DTOs\InvoiceItem;
use Tigusigalpa\ShipTime\DTOs\InvoiceContact;
use Tigusigalpa\ShipTime\Enums\Currency;
use Tigusigalpa\ShipTime\Enums\ReasonForExport;
use Tigusigalpa\ShipTime\Enums\DutiesPaidBy;

$invoiceContact = new InvoiceContact(
    companyName: 'Exporter Inc',
    streetAddress: '123 Export St',
    city: 'Toronto',
    countryCode: 'CA',
    state: 'ON',
    postalCode: 'M5H 2N2',
    attention: 'Export Manager',
    phone: '416-555-0001'
);

$dutiesAndTaxes = new DutiesAndTaxes(
    dutiable: true,
    paidBy: DutiesPaidBy::CONSIGNEE
);

$invoiceItem = new InvoiceItem(
    quantity: 2,
    code: '123456',
    description: 'Electronic Components',
    origin: 'CA',
    provinceOrState: 'ON',
    unitPrice: 5000 // in cents
);

$customsInvoice = new CustomsInvoice(
    dutiesAndTaxes: $dutiesAndTaxes,
    invoiceContact: $invoiceContact,
    currency: Currency::CAD,
    invoiceItems: [$invoiceItem],
    reasonForExport: ReasonForExport::COMMERCIAL
);

// Add customs invoice to rate request
$rateRequest = new RateRequest(
    from: $from,
    to: $to,
    packageType: PackageType::PACKAGE,
    lineItems: [$lineItem],
    unitOfMeasurement: UnitOfMeasurement::METRIC,
    shipDate: '2024-02-20',
    customsInvoice: $customsInvoice
);
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Run tests with coverage:

```
composer test:coverage
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

Credits
-------

[](#credits)

- [Igor Sazonov](https://github.com/tigusigalpa)
- [All Contributors](../../contributors)

Support
-------

[](#support)

For support, please contact  or open an issue on GitHub.

Links
-----

[](#links)

- [ShipTime API Documentation](https://restapi.shiptime.com/doc/index.html)
- [ShipTime Website](https://www.shiptime.com)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance75

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

138d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2721390?v=4)[Igor Sazonov](/maintainers/tigusigalpa)[@tigusigalpa](https://github.com/tigusigalpa)

---

Top Contributors

[![tigusigalpa](https://avatars.githubusercontent.com/u/2721390?v=4)](https://github.com/tigusigalpa "tigusigalpa (2 commits)")

---

Tags

apifulfillmentfulfilment-managerlaravelphpshiptimeshiptime-apiapiclientlaravelshippingshiptime

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tigusigalpa-shiptime-php/health.svg)

```
[![Health](https://phpackages.com/badges/tigusigalpa-shiptime-php/health.svg)](https://phpackages.com/packages/tigusigalpa-shiptime-php)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k9.5M89](/packages/openai-php-laravel)[resend/resend-laravel

Resend for Laravel

1222.7M9](/packages/resend-resend-laravel)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)[smodav/mpesa

M-Pesa API implementation

16467.9k1](/packages/smodav-mpesa)[mozex/anthropic-laravel

Laravel integration for the Anthropic API: facade, config publishing, install command, testing fakes, messages, streaming, tool use, thinking, and batches.

74331.3k1](/packages/mozex-anthropic-laravel)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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