Connection
in package

This is the Connection class in the LogiCommerce SDK package.

All LogiCommerce API connections are done through this class.

Tags
see
Connection::getInstance()
see
Connection::get()
see
Connection::post()
see
Connection::put()
see
Connection::delete()
see
Connection::getRequestHeaders()

Table of Contents

CODE  = 'code'
RESULT  = 'result'
STATUS  = 'status'
doRequest() This will made a curl petition to the given API resource with the given method.  : array<string|int, mixed>
getHost() Returns the website host.  : string
getInstance() Returns the Connection instance.  : Connection
getIp()  : string
getRequestHeaders() Returns the request frequent needed headers.  : array<string|int, mixed>
isHttps() Returns if the website is being used with the secure protocol "https".  : string

Constants

CODE

public mixed CODE = 'code'
Tags
staticvar

string

RESULT

public mixed RESULT = 'result'
Tags
staticvar

string

STATUS

public mixed STATUS = 'status'
Tags
staticvar

string

Methods

doRequest()

This will made a curl petition to the given API resource with the given method.

public doRequest(Request $request[, string $apiUrl = null ]) : array<string|int, mixed>

The return will be the deserialized API response.

Parameters
$request : Request

The request with all the needed data to send it

$apiUrl : string = null

The URL of the API we want to do the request on

Tags
throws
ConnectionException
Return values
array<string|int, mixed>

getHost()

Returns the website host.

public static getHost() : string
Return values
string

getInstance()

Returns the Connection instance.

public static getInstance() : Connection

If is not setted, this method will set it.

Return values
Connection

getIp()

public static getIp() : string
Return values
string

getRequestHeaders()

Returns the request frequent needed headers.

public static getRequestHeaders() : array<string|int, mixed>

Those headers are:

  • userAgent (HTTP_USER_AGENT)
  • serverAddr (SERVER_ADDR)
  • remoteAddr (REMOTE_ADDR)
  • ip (Calculated. Not necessarily the same as "remoteAddr")
  • referer (HTTP_REFERER)
  • hostName (gethostname)
All of them extracted from $_SERVER scope
Return values
array<string|int, mixed>

isHttps()

Returns if the website is being used with the secure protocol "https".

public static isHttps() : string
Return values
string

Search results