Download the PHP package robinhq/api without Composer
On this page you can find all versions of the php package robinhq/api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package api
ROBIN API Wrapper
This library wraps the ROBIN Api behind a user friendly interface.
The basics
In essence, this library can send customers and orders from your e-commerse solution straight into ROBIN. The ROBIN API expects these customers and orders to be formatted in a specific way, this can also help you to transform your internal order and customer objects to the objects ROBIN understand.
Objects
The ROBIN API expects two different collections of objects, being customers and orders. Below I'll explain how to create both objects.
Customer
To make a ROBIN Customer object, all you need to do is the following:
To send a customer (or a collection of customers) you should always make a Customers collection:
Now, you can send the collection of customers to ROBIN with the following line of code:
So, to combine everything:
The Customers collection makes it really easy to send more customers to ROBIN. Just loop over your existing customers and keep pushing ROBIN Customers into the Customers collection, like so:
Orders
The order object for the ROBIN API is a bit harder to understand due to the way the API expects the data to be given. A order is made in the following way:
where $listView
is an instance of the ListView
class and $detailsView
an instance of the DetailsView
class.
To read more about these two objects, please revert to the ROBIN API docs.
A ListView
is the object that represents the data when the order is viewed inside a list. This object contains the
order-number, -date and -status. Creating a ListView is done like this:
Thus far, it's not that hard. The harder part comes when we are going to add the details view to the robin order.
Inside the details view, there can be any kind of object. This library comes with OrderDetails
, Products
,
Invoices
andShipment
details.
To create these details, first we have to create the DetailsView
collection that contains all of the details.
Next create the order details and add them to the DetailsView
This will add a DetailsViewItem
with OrderDetails
as it's data to the DetailsView
. The DetailsViewItem
will
be displayed as details
.
When you convert a detailViewItem
to Json or an Array, they get formatted like this:
All public properties are converted to snake case, as this is what the ROBIN API expects.
To add product details, simply do the following:
This works the same for Invoices
and Shipments
details.
Creating your own details
The ROBIN API allows you to send your own data towards it. The code blow shows you how to do this.
All versions of api with dependencies
robinhq/support Version ~0.1.0
monolog/monolog Version ^1.14
nesbot/carbon Version ^1.21
illuminate/support Version ^5.1