PHPackages                             dan-rogers/shiptheory-php-client - 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. dan-rogers/shiptheory-php-client

ActiveLibrary[API Development](/categories/api)

dan-rogers/shiptheory-php-client
================================

An API client to communicate with the Shiptheory API

v1.0.0(2y ago)010MITPHPPHP &gt;= 8.1

Since Mar 24Pushed 2y ago2 watchersCompare

[ Source](https://github.com/DanRVP/shiptheory-php-client)[ Packagist](https://packagist.org/packages/dan-rogers/shiptheory-php-client)[ RSS](/packages/dan-rogers-shiptheory-php-client/feed)WikiDiscussions main Synced yesterday

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

shiptheory-php-client
=====================

[](#shiptheory-php-client)

Client to handle sending HTTP requests to the Shiptheory V1 REST API. Handles logging, authentication/refreshing tokens. Uses PSR compliant interfaces and dependency injection where possible.

**View on Pakagist:**

**View Shiptheory API Docs**:

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

[](#installation)

```
composer require dan-rogers/shiptheory-php-client

```

Usage
-----

[](#usage)

The client uses DI in conjunction with existing PSR standards so that you can operate in your preferred environment with your preferred libraries. The HTTP client required on instantiation must implement PSR18 and the optional logger you can use on instantiation must implement PSR3.

### Tokens

[](#tokens)

#### Types of Token

[](#types-of-token)

Shiptheory offers 2 kinds of authentication:

1. **Credential based access:** Users must pass their login credentials to the `/token` endpoint to exchange them for a JWT access token which can then be used in subsequent requests. This token lasts for one hour, but a new one can be generated at any time.
2. **Permanent tokens:** You can generate an unchanging, permanent token by logging into your account and going to [https://helm.shiptheory.com/user\_tokens](https://helm.shiptheory.com/user_tokens)

#### Implementation

[](#implementation)

To use credential access tokens you should pass an instance of `ShiptheoryClient\Authorization\CredentialsAccessToken` to your new instance of the Shiptheory Client. The token will automatically refresh itself. When instantiated you must pass your username and password as arguments.

```
