Download the PHP package dormilich/arin-client without Composer
On this page you can find all versions of the php package dormilich/arin-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dormilich/arin-client
More information about dormilich/arin-client
Files in dormilich/arin-client
Package arin-client
Short Description A PHP library to communicate with the ARIN database.
License LGPL-2.1
Homepage https://github.com/Dormilich/arin-client
Informations about the package arin-client
ArinDB-Client
A PHP library to communicate with the ARIN database (Reg-RWS).
Setting up data objects
There is a multitude of possibilities to set up the data object.
- The XML leaf nodes (e.g.
<city>
) usesetValue()
- collection elements (such as
<comment>
or<originASes>
) also supportaddValue()
- all payloads use
set()
andadd()
together with the element name - payloads and collection elements implement the
ArrayAccess
interface. I.e. you can traverse the XML structure as if it were a multidimensional array (where collections represent numerically indexed and payloads associative arrays). Note that you can only set named leaf nodes’ values via array access (cf.$net['ASN']
vs.$net['net']
in the example below).
These data objects perform some basic validation (you can’t put an object into a field that expects a string and vice versa, some type-related fields allow only predefined values) but generally you have to know what belongs where.
Exceptions are fired for
- invalid value types
- value constraint violations
- accessing non-existent fields
Setting up the web service
For the web service to work, you need a connection object that implements the ClientAdapter
interface. This can be
an existing library or you can write the connectivity functionality yourself (although I recommend the first option).
To configure the web service itself there are four options to set:
- environment : either "live" for the prduction database or "test" for the OT&E database.
- password : your respective API key for accessing either database.
- encoding : the encoding charset for the XML you will send. Defaults to UTF-8.
- strict : set this option to FALSE if you want to bypass the pre-serialisation validity check. Defaults to TRUE.
Working with the web service
There are two web service objects available: TicketRWS for anything that is processed through tickets (tickets, reports, and ROA) and CommonRWS that relates to CRUD operations (such as assigning a network to a customer).
Error handling
The error handling depends on how your connection object handles HTTP errors. If the Reg-RWS returns an error
payload, you can convert that to an object via Payload::loadXML()
or you use the object you received from
the web service call if your connection didn’t throw an exception.
Note
All payloads and group elements are iterable and can therefore be used directly in a foreach()
loop.
Additionally, payloads can be serialised into JSON.
All elements can be converted into a string. If there is an XML attribute associated with that element, you can access it as the object’s property.