Download the PHP package dan-rogers/shiptheory-php-client without Composer

On this page you can find all versions of the php package dan-rogers/shiptheory-php-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package 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: https://packagist.org/packages/dan-rogers/shiptheory-php-client

View Shiptheory API Docs: https://shiptheory.com/developer/index.html

Installation

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

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

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.

To use a permanent access token you should pass and instance of ShiptheoryClient\Authorization\PermanentAccessToken to your new instance of the Shiptheory Client. When instantiated you must pass your permanent token as the argument.

Example Usage

The below example uses guzzlehttp/guzzle for the client, the CredentialsAccessToken for authorisation and monolog/monolog for the logging.

Logging

Enabling Logging

Logging is provided via DI. Pass in any PSR3 compliant logger object when instantiating ShiptheoryClient and the logging will be handled automatically for both requests and responses. If a logger is not provided then all logs a "blackholed" via use of Psr\Log\NullLogger.

Example Log Output

When using logging your PSR7 messages will be converted into their HTTP request quivalent. The following was generated using monolog/monlog, but the general format of a transaction ID followed by a stringed request or response will be consistent regardless of the PSR3 compliant logging solution you use.

Using a Shiptheory Partner Tag

"If you are developing an application that will be used by more than 1 company, or an application that you intend to distribute in anyway, you must include the Shiptheory-Partner-Tag http request header in all of your requests. Please contact Shiptheory support to obtain a partner tag. There is no charge for this, tags are used to provide better support to customers and partners." - API Docs

In order to add a partner tag to your API requests add it as the fourth argument when instantiating a new ShiptheoryClient.


All versions of shiptheory-php-client with dependencies

PHP Build Version
Package Version
Requires php Version >= 8.1
psr/http-client Version ^1.0
psr/log Version ^3.0
nyholm/psr7 Version ^1.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dan-rogers/shiptheory-php-client contains the following files

Loading the files please wait ....