Download the PHP package dan-rogers/shiptheory-php without Composer
On this page you can find all versions of the php package dan-rogers/shiptheory-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dan-rogers/shiptheory-php
More information about dan-rogers/shiptheory-php
Files in dan-rogers/shiptheory-php
Package shiptheory-php
Short Description An API client to communicate with the Shiptheory API
License MIT
Informations about the package shiptheory-php
Shiptheory API library for PHP
A Python version exists: Shiptheory API library for Python
- To create pull requests fork this repository (Please adhere to the guidelines in the pull request template).
- Use GitHub issues to detail any problems encountered.
Features
- Build Shiptheory request bodies and queries with ease.
- Dedicated methods to query each Shiptheory endpoint.
- Automatic token authentication. Just provide your credentials and the library will keep your tokens valid for as long as you need.
- Standardised error messaging.
- Configuration via .env
Installation
Require with composer:
Configuration
The library currently utilises a .env file to configure certain aspects of the library.
IMPORTANT: It does not use any version of phpdotenv and instead uses its own custom implementation to keep it lightweight.
Copy values from .env.example
into a new or existing .env file in the root of your project.
Currently supported configuration options:
- SHIPTHEORY_PHP_LOG_REQUESTS - (Boolean) When set to
true
requests are logged. Whenfalse
or nonexistent requests are not logged. - SHIPTHEORY_PHP_SSL_VERIFY_PEER - (Boolean) When set to
true
SSL verification is enabled. Whenfalse
or nonexistent requests do not use SSL verification. - SHIPTHEORY_PHP_LOG_PATH - (String) When a string is set it is used as the path to the folder where log files are generated.
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 third argument when instantiating a new ShiptheoryClient.
Usage
The workflow is similar for all endpoints, queries and bookings. Examples exist in the file Examples
. If you want to see all endpoint methods, then look in src/Http/ShiptheoryClient.php
.
It is recommended that you use the objects provied to build your requests as they will result with a perfect request body every time. However, if you wish you can just provide the query parameters or the JSON body (depending on request type) as a string to the method you are calling.