ShipEngine / shipengine-php

The official PHP SDK for ShipEngine API
https://www.shipengine.com/docs/
Apache License 2.0
15 stars 11 forks source link
address-normalization address-validation dhl-api fedex-api package-tracking php rest-api sdk shipengine shipment-tracking shipping-api shipping-cost shipping-label shipping-rates tracking-number ups-api usps-api

ShipEngine

ShipEngine PHP

Build Status Coverage Status Latest Version License OS Compatibility

A PHP library built on the ShipEngine API offering low-level access as well as convenience methods.

Table of Contents

Quick Start

Install ShipEngine via Composer:

composer require shipengine/shipengine

The following example assumes that you have already set the SHIPENGINE_API_KEY environment variable with your Api Key using putenv().

Examples

Methods

Class Objects

Instantiate ShipEngine Class

<?php declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use ShipEngine\ShipEngine;

$apiKey = getenv('SHIPENGINE_API_KEY');

$shipengine = new ShipEngine($apiKey);

require DIR . '/vendor/autoload.php';

use ShipEngine\ShipEngine;

$apiKey = getenv('SHIPENGINE_API_KEY');

$config = array( 'apiKey' => $apiKey, 'pageSize' => 75, 'retries' => 3, 'timeout' => \DateInterval('PT60S') );

$shipengine = new ShipEngine($config);


Testing
=======
- You can now run all tests using [PHPUnit](https://phpunit.de/):
_phpunit_
```bash
composer test

Linting

You can utilize the composer script that runs phpcs, phpstan, and php-cs-fixer.

composer lint

Contributing

Contributions, enhancements, and bug-fixes are welcome! Open an issue on GitHub and submit a pull request.

We are managing php environment with Nix and Direnv, and we recommend downloading them before contributing to this project.

This project also makes use of pre-commit hooks to help run lint and tests at time of commit, to leverage this you will need to install pre-commit and run the following command while in this repo:

pre-commit install