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

ActiveLibrary[API Development](/categories/api)

tigusigalpa/easyship-php
========================

Modern PHP/Laravel client for EasyShip API with full endpoint coverage

v1.0.0(3mo ago)20MITPHPPHP ^8.1

Since Feb 16Pushed 3mo agoCompare

[ Source](https://github.com/tigusigalpa/easyship-php)[ Packagist](https://packagist.org/packages/tigusigalpa/easyship-php)[ RSS](/packages/tigusigalpa-easyship-php/feed)WikiDiscussions main Synced 1mo ago

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

EasyShip PHP/Laravel Client
===========================

[](#easyship-phplaravel-client)

[![EasyShip PHP SDK](https://private-user-images.githubusercontent.com/2721390/550528551-8bc769b8-df00-4fd7-bb4d-8073a8fbf997.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzIwNTE2NTQsIm5iZiI6MTc3MjA1MTM1NCwicGF0aCI6Ii8yNzIxMzkwLzU1MDUyODU1MS04YmM3NjliOC1kZjAwLTRmZDctYmI0ZC04MDczYThmYmY5OTcuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDIyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjAyMjVUMjAyOTE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Mzc0NzQyMjY5NTA2N2FiMzMzODJhMWJjYjJkYzM3MzFiZmMzZTBmMTg5NWExOTkwODZkNjhiNzVmMDI1MTFjZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.SFknXV60IVdYnzLiXHP2d8gbcH1e0F-k7KXPJyehwVY)](https://private-user-images.githubusercontent.com/2721390/550528551-8bc769b8-df00-4fd7-bb4d-8073a8fbf997.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzIwNTE2NTQsIm5iZiI6MTc3MjA1MTM1NCwicGF0aCI6Ii8yNzIxMzkwLzU1MDUyODU1MS04YmM3NjliOC1kZjAwLTRmZDctYmI0ZC04MDczYThmYmY5OTcuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDIyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjAyMjVUMjAyOTE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Mzc0NzQyMjY5NTA2N2FiMzMzODJhMWJjYjJkYzM3MzFiZmMzZTBmMTg5NWExOTkwODZkNjhiNzVmMDI1MTFjZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.SFknXV60IVdYnzLiXHP2d8gbcH1e0F-k7KXPJyehwVY)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0365401077476424784fabcf106c7183eb53275def18986aa837968936163b40/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74696775736967616c70612f65617379736869702d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tigusigalpa/easyship-php)[![License](https://camo.githubusercontent.com/d6200e71ded1a70e1444634db0a123a9ad7310c02d032de16e99853eb2b3481d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f74696775736967616c70612f65617379736869702d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tigusigalpa/easyship-php)

Modern, fully-featured PHP/Laravel client for the [EasyShip API](https://easyship.com/) with complete endpoint coverage (348+ endpoints).

Features
--------

[](#features)

- ✅ **Complete API Coverage** - All 348+ EasyShip API endpoints implemented
- ✅ **Modern PHP** - Built for PHP 8.1+ with strict typing
- ✅ **Laravel Integration** - Service Provider, Facade, and configuration
- ✅ **Webhook Support** - Full webhook handling with signature verification
- ✅ **OAuth 2.0** - Complete OAuth flow for partner integrations
- ✅ **Exception Handling** - Typed exceptions for different error scenarios
- ✅ **Retry Logic** - Automatic retry for transient failures
- ✅ **Sandbox/Production** - Easy environment switching
- ✅ **PSR-4 Autoloading** - Follows PSR-12 coding standards
- ✅ **Well Documented** - Comprehensive PHPDoc comments

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

[](#requirements)

- PHP 8.1 or higher
- Laravel 9, 10, 11, or 12 (optional)
- Guzzle HTTP Client 7.0+

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

[](#installation)

Install via Composer:

```
composer require tigusigalpa/easyship-php
```

Configuration
-------------

[](#configuration)

### Standalone PHP

[](#standalone-php)

```
use Tigusigalpa\EasyShip\EasyShipClient;

$client = new EasyShipClient([
    'api_token' => 'sand_xxxxxxxxxxxxxxxx', // or prod_xxxxxxxxxxxxxxxx
    'timeout' => 30,
    'retry' => 3,
]);
```

### Laravel

[](#laravel)

1. Publish the configuration file:

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

2. Add your API token to `.env`:

```
EASYSHIP_API_TOKEN=sand_xxxxxxxxxxxxxxxx
EASYSHIP_TIMEOUT=30
EASYSHIP_RETRY=3
```

3. Use the Facade or dependency injection:

```
use Tigusigalpa\EasyShip\Laravel\Facades\EasyShip;

// Using Facade
$shipments = EasyShip::shipments()->list();

// Using Dependency Injection
use Tigusigalpa\EasyShip\EasyShipClient;

class ShippingController extends Controller
{
    public function __construct(private EasyShipClient $easyship)
    {
    }

    public function index()
    {
        $shipments = $this->easyship->shipments()->list();
    }
}
```

Quick Start
-----------

[](#quick-start)

### Create a Shipment

[](#create-a-shipment)

```
$shipment = $client->shipments()->create([
    'platform_name' => 'Custom',
    'platform_order_number' => 'ORDER-001',
    'destination_address' => [
        'line_1' => '123 Main St',
        'city' => 'New York',
        'state' => 'NY',
        'postal_code' => '10001',
        'country_code' => 'US',
        'contact_name' => 'John Doe',
        'contact_phone' => '+1234567890',
        'contact_email' => 'john@example.com',
    ],
    'items' => [
        [
            'description' => 'T-Shirt',
            'sku' => 'TSHIRT-001',
            'quantity' => 2,
            'declared_currency' => 'USD',
            'declared_customs_value' => 25.00,
            'actual_weight' => 0.5,
        ],
    ],
]);
```

### Get Shipping Rates

[](#get-shipping-rates)

```
$rates = $client->rates()->calculate([
    'origin_country_code' => 'US',
    'origin_postal_code' => '90001',
    'destination_country_code' => 'GB',
    'destination_postal_code' => 'SW1A 1AA',
    'items' => [
        [
            'actual_weight' => 1.5,
            'height' => 10,
            'width' => 10,
            'length' => 10,
            'declared_currency' => 'USD',
            'declared_customs_value' => 50.00,
        ],
    ],
]);
```

### List Shipments

[](#list-shipments)

```
$shipments = $client->shipments()->list([
    'page' => 1,
    'per_page' => 50,
    'status' => 'delivered',
]);
```

### Track a Shipment

[](#track-a-shipment)

```
$tracking = $client->trackings()->show('TRACKING_NUMBER');
```

API Modules
-----------

[](#api-modules)

The client provides access to all EasyShip API resources through dedicated modules:

### Account &amp; Settings

[](#account--settings)

- `account()` - Account information
- `settings()` - Account settings management

### Addresses

[](#addresses)

- `addresses()` - Address management and validation

### Analytics

[](#analytics)

- `analytics()` - Analytics and reporting data

### Shipments

[](#shipments)

- `shipments()` - Create, update, and manage shipments
- `rates()` - Get shipping rates
- `trackings()` - Track shipments
- `labels()` - Generate shipping labels

### Couriers

[](#couriers)

- `couriers()` - Courier management
- `courierServices()` - Courier service information

### Products &amp; Inventory

[](#products--inventory)

- `products()` - Product catalog management
- `boxes()` - Box/packaging management

### Pickups

[](#pickups)

- `pickups()` - Schedule and manage pickups

### Financial

[](#financial)

- `credit()` - Credit management
- `paymentSources()` - Payment source management
- `billingDocuments()` - Billing document access
- `transactionRecords()` - Transaction history

### Webhooks

[](#webhooks)

- `webhooks()` - Webhook configuration

### Organizations &amp; Companies

[](#organizations--companies)

- `organizations()` - Organization management
- `companies()` - Company management

### Shipping Rules

[](#shipping-rules)

- `shippingRules()` - Automated shipping rule configuration

### Other Resources

[](#other-resources)

- `batches()` - Batch operations
- `manifests()` - Manifest generation
- `insurancePolicies()` - Insurance management
- `taxesAndDuties()` - Tax and duty calculations
- `stores()` - Store integrations
- `tags()` - Tag management
- `locations()` - Drop-off location finder

Webhooks
--------

[](#webhooks-1)

### Setting Up Webhook Handler

[](#setting-up-webhook-handler)

```
use Tigusigalpa\EasyShip\Webhooks\WebhookHandler;
use Tigusigalpa\EasyShip\Webhooks\WebhookVerifier;

$verifier = new WebhookVerifier('your-webhook-secret');
$handler = new WebhookHandler($verifier);

// In your webhook endpoint
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_EASYSHIP_SIGNATURE'] ?? '';

try {
    $event = $handler->handle($payload, $signature);

    // Handle different event types
    if ($event instanceof \Tigusigalpa\EasyShip\Webhooks\Events\ShipmentCreated) {
        $shipmentId = $event->getShipmentId();
        // Handle shipment created
    }
} catch (\Tigusigalpa\EasyShip\Exceptions\EasyShipException $e) {
    // Invalid signature or malformed payload
    http_response_code(400);
}
```

### Laravel Webhook Example

[](#laravel-webhook-example)

```
// routes/api.php
Route::post('/webhooks/easyship', [WebhookController::class, 'handle']);

// app/Http/Controllers/WebhookController.php
use Tigusigalpa\EasyShip\Webhooks\WebhookHandler;
use Tigusigalpa\EasyShip\Webhooks\WebhookVerifier;

class WebhookController extends Controller
{
    public function handle(Request $request)
    {
        $verifier = new WebhookVerifier(config('easyship.webhook_secret'));
        $handler = new WebhookHandler($verifier);

        $event = $handler->handle(
            $request->getContent(),
            $request->header('X-Easyship-Signature')
        );

        event(new EasyShipWebhookReceived($event));

        return response()->json(['status' => 'success']);
    }
}
```

OAuth 2.0
---------

[](#oauth-20)

For partner integrations using OAuth:

```
// Step 1: Redirect user to authorization URL
$authUrl = "https://app.easyship.com/oauth/authorize?" . http_build_query([
    'client_id' => 'your-client-id',
    'redirect_uri' => 'https://yourapp.com/callback',
    'response_type' => 'code',
    'scope' => 'shipments:read shipments:write',
]);

// Step 2: Exchange authorization code for access token
$token = $client->oauth()->createAccessToken([
    'grant_type' => 'authorization_code',
    'code' => $authorizationCode,
    'client_id' => 'your-client-id',
    'client_secret' => 'your-client-secret',
    'redirect_uri' => 'https://yourapp.com/callback',
]);

// Step 3: Use the access token
$client = new EasyShipClient([
    'api_token' => $token['access_token'],
]);
```

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

[](#error-handling)

The library provides typed exceptions for different error scenarios:

```
use Tigusigalpa\EasyShip\Exceptions\AuthenticationException;
use Tigusigalpa\EasyShip\Exceptions\ValidationException;
use Tigusigalpa\EasyShip\Exceptions\RateLimitException;
use Tigusigalpa\EasyShip\Exceptions\ApiException;

try {
    $shipment = $client->shipments()->create($data);
} catch (AuthenticationException $e) {
    // Invalid API token (401)
    echo "Authentication failed: " . $e->getMessage();
} catch (ValidationException $e) {
    // Validation errors (422)
    echo "Validation failed: " . $e->getMessage();
    print_r($e->getErrors());
} catch (RateLimitException $e) {
    // Rate limit exceeded (429)
    echo "Rate limit exceeded. Please try again later.";
} catch (ApiException $e) {
    // Other API errors
    echo "API error: " . $e->getMessage();
}
```

Environment Switching
---------------------

[](#environment-switching)

The library automatically detects sandbox vs production based on your API token prefix:

- Tokens starting with `sand_` use the sandbox environment
- Tokens starting with `prod_` use the production environment

```
// Sandbox
$client = new EasyShipClient([
    'api_token' => 'sand_xxxxxxxxxxxxxxxx',
]);

// Production
$client = new EasyShipClient([
    'api_token' => 'prod_xxxxxxxxxxxxxxxx',
]);
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

API Documentation
-----------------

[](#api-documentation)

For detailed API documentation, visit:

- [EasyShip API Reference](https://developers.easyship.com/reference/introduction)
- [EasyShip Developer Portal](https://developers.easyship.com/)

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for recent changes.

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

[](#contributing)

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

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

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

License
-------

[](#license)

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

Support
-------

[](#support)

For support, please:

- Check the [EasyShip API Documentation](https://developers.easyship.com/)
- Open an issue on [GitHub](https://github.com/tigusigalpa/easyship-php/issues)
- Contact:

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance82

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

91d 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

apiapi-clientapi-client-phpeasyshiplaravelphpapilaravelshippinglogisticseasyship

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/tigusigalpa-easyship-php/health.svg)](https://phpackages.com/packages/tigusigalpa-easyship-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.7k7.6M74](/packages/openai-php-laravel)[nickurt/laravel-postcodeapi

Universal PostcodeApi for Laravel 11.x/12.x/13.x

97221.2k](/packages/nickurt-laravel-postcodeapi)[smodav/mpesa

M-Pesa API implementation

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

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

762.6k](/packages/scriptdevelop-whatsapp-manager)[bushlanov-dev/max-bot-api-client-php

Max Bot API Client library

281.6k](/packages/bushlanov-dev-max-bot-api-client-php)

PHPackages © 2026

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