Download the PHP package sanmai/shipandco-sdk without Composer
On this page you can find all versions of the php package sanmai/shipandco-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sanmai/shipandco-sdk
More information about sanmai/shipandco-sdk
Files in sanmai/shipandco-sdk
Informations about the package shipandco-sdk
Ship&co API integration SDK
Features:
- [ ] Shipments
- [x] Create Shipment
- [ ] List Shipments
- [ ] Get Shipment
- [ ] Delete Shipment
- [x] Rate
- [x] List Rates
- [ ] Carrier
- [ ] Register Carrier
- [x] List Carriers
- [ ] Update Carrier
- [ ] Delete Carrier
- [ ] Tracking
- [ ] Address
- [ ] Register Address
- [x] List Addresses
- [ ] Warehouse
- [ ] Register Warehouse
- [x] List Warehouses
- [ ] Sub User
- [ ] Register Sub User
- [ ] List Sub User
- [ ] Get Sub User
- [ ] Refresh Sub User
- [ ] Delete Sub User
This library is far from offering a complete set of API methods, but it should do the most important bits.
Something is amiss? Let us know, or, even better, send a PR!
Ship&co API documentation for your reference. Please note this is not in any way an official SDK of Ship&co, therefore most likely they won't be able to answer any questions about this SDK.
Installation
This SDK requires at least PHP 7.3. It was tested to work under PHP 7.3, 7.4, and 8.0.
Overview
Major parts are:
- Client. Client is the object you send all requests through.
- Requests. There are several request objects for most requests the API offers. They follow a fluent interface paradigm, where if the original request has a certain property, a request here will have it too. More on this below.
- Responses. After sending a request you'll have a response object, which could be an actual reponse, or an error response. All responses follow the same fluent paradigm.
Usage
First, you need to acquire an access token as outlined in the documentation.
Next, instantiate a client using a convenient builder:
The builder has several more convenience methods to set timeouts and enable caching. Check with the source code.
Error handling
Error handling is built upon error responses. Exceptions are almost never thrown. If there's an exception, this has to be a truly exceptional situation, even a bug.
Requests
For every implemented request there's a runnable example. E.g. running this:
...Will output your registered carriers.
Examples come with a debugging output enabled so that you can experiment freely.
Obviosly, to run examples you'll need to have the library checked out:
List Carriers
List Addresses
List Warehouses
List Rates
Create Shipment
As far as shipments go, it's important to understand that requests for domestic shipments over Japan (Sagawa, Yamato, YuPack) are a bit different from an International shipments:
- For domestic shipments addresses (to and from) should be in Japanese. The opposite is true for International shipments.
- No city field is needed for domestic shipments (city goes to
address_1
). - No need for most details about product: on the contrary, for International shipments, details about products are used for customs clearance purpose.
- For domestic shipments, if it's not a cash on delivery shipment, product name only should work (just to show on the label wha'ts inside the box).
This SDK poses no restrictions on the number of fields specified in a request (other than that they should exist), thus it is a user responsibility (yours) to set correct fields for each type of request.
To safeguard you against unexpected billing charges, shipment requests are using the test environment by default (thus creating dummy labels). Make sure to set test
to false
in setup
section to receive live labels.
Just like so:
License
This project is licensed under the terms of the MIT license.
All versions of shipandco-sdk with dependencies
ext-json Version *
doctrine/annotations Version ^1.14 || ^2.0
guzzlehttp/guzzle Version ^6.3 || ^7.0
jms/serializer Version ^3.9
sanmai/json-serializer Version ^0.1.1 || ^0.2.4
sanmai/pipeline Version ^5 || ^6
sanmai/sdk-common Version ^0.5.4
sanmai/version-info Version ^0.2.0
symfony/http-foundation Version ^4.4.7 || ^5.0.7