Salaros\Vtiger\VTWSCLib

Salaros\Vtiger\VTWSCLib\Entities

class Entities

Vtiger Web Services PHP Client Session class

Class Entities

__construct($wsClient)

Class constructor

Parameters:
  • $wsClient (object) – Parent WSClient instance
findOneByID($moduleName, $entityID, $select =[])

Retrieves an entity by ID

Parameters:
  • $moduleName
  • $entityID
  • $select
Returns:

array $select The list of fields to select (defaults to SQL-like ‘*’ - all the fields)

findOne($moduleName, $params, $select =[])

Retrieve the entity matching a list of constraints

Parameters:
  • $moduleName
  • $params
  • $select
Returns:

array $select The list of fields to select (defaults to SQL-like ‘*’ - all the fields)

getID($moduleName, $params)

Retrieves the ID of the entity matching a list of constraints + prepends ‘<module_id>x’ string to it

Parameters:
  • $moduleName
  • $params
Returns:

string Type ID (a numeric ID + ‘<module_id>x’)

getNumericID($moduleName, $params)

Retrieve a numeric ID of the entity matching a list of constraints

Parameters:
  • $moduleName
  • $params
Returns:

integer Numeric ID

createOne($moduleName, $params)

Creates an entity for the giving module

Parameters:
  • $moduleName
  • $params
Returns:

array Entity creation results

updateOne($moduleName, $entityID, $params)

Updates an entity

Parameters:
  • $moduleName
  • $entityID
  • $params
Returns:

array Entity update result

deleteOne($moduleName, $entityID)

Provides entity removal functionality

Parameters:
  • $moduleName
  • $entityID
Returns:

array Removal status object

findMany($moduleName, $params, $select =, []$limit = 0)

Retrieves multiple records using module name and a set of constraints

Parameters:
  • $moduleName
  • $params
  • $select
  • $limit
Returns:

array $select The list of fields to select (defaults to SQL-like ‘*’ - all the fields)

sync($modifiedTime = null, $moduleName = null)

Sync will return a sync result object containing details of changes after modifiedTime

Parameters:
  • $modifiedTime
  • $moduleName
Returns:

array Sync result object

getQueryString($moduleName, $params, $select =, []$limit = 0)

Builds the query using the supplied parameters

Parameters:
  • $moduleName
  • $params
  • $select
  • $limit
Returns:

string $select The list of fields to select (defaults to SQL-like ‘*’ - all the fields)

Salaros\Vtiger\VTWSCLib\Modules

class Modules

Vtiger Web Services PHP Client Session class

Class Modules

__construct($wsClient)

Class constructor

Parameters:
  • $wsClient (object) – Parent WSClient instance
getAll()

Lists all the Vtiger entity types available through the API

Returns:array List of entity types
getOne($moduleName)

Get the type information about a given VTiger entity type.

Parameters:
  • $moduleName
Returns:

array Result object

getTypedID($moduleName, $entityID)

Gets the entity ID prepended with module / entity type ID

Parameters:
  • $moduleName
  • $entityID
Returns:

boolean|string Returns false if it is not possible to retrieve module / entity type ID

Salaros\Vtiger\VTWSCLib\Session

class Session

Vtiger Web Services PHP Client Session class

Class Session

property httpClient

protected

property vtigerUrl

protected

property wsBaseURL

protected

__construct($vtigerUrl, $wsBaseURL = 'webservice.php')

Class constructor

Parameters:
  • $vtigerUrl (string) – The URL of the remote WebServices server
  • $wsBaseURL
login($username, $accessKey)

Login to the server using username and VTiger access key token

Parameters:
  • $username
  • $accessKey
Returns:

boolean Returns true if login operation has been successful

loginPassword($username, $password, $accessKey = null)

Allows you to login using username and password instead of access key (works on some VTige forks)

Parameters:
  • $username
  • $password
  • $accessKey
Returns:

boolean Returns true if login operation has been successful

passChallenge($username)

Gets a challenge token from the server and stores for future requests

Parameters:
  • $username
Returns:

boolean Returns false in case of failure

getUserInfo()

Gets an array containing the basic information about current API user

Returns:array Basic information about current API user
getVtigerVersion()

Gets vTiger version, retrieved on successful login

Returns:string vTiger version, retrieved on successful login
getVtigerApiVersion()

Gets vTiger WebServices API version, retrieved on successful login

Returns:string vTiger WebServices API version, retrieved on successful login
sendHttpRequest($requestData, $method = 'POST')

Sends HTTP request to VTiger web service API endpoint

Parameters:
  • $requestData
  • $method
Returns:

array Returns request result object (null in case of failure)

fixVtigerBaseUrl($baseUrl)

Cleans and fixes vTiger URL

Parameters:
  • $baseUrl (string) –
Returns:

string Returns cleaned and fixed vTiger URL

checkForError($jsonResult)

Check if server response contains an error, therefore the requested operation has failed

Parameters:
  • $jsonResult
Returns:

boolean True if response object contains an error

Salaros\Vtiger\VTWSCLib\WSClient

class WSClient

Vtiger Web Services PHP Client

Class WSClient

property modules
property entities
__construct($vtigerUrl, $username, $secret, $loginMode = self::USE_ACCESSKEY, $wsBaseURL = 'webservice.php')

Class constructor

Parameters:
  • $vtigerUrl (string) – The URL of the remote WebServices server
  • $username
  • $secret
  • $loginMode
  • $wsBaseURL
invokeOperation($operation, $params = null, $method = 'POST')

Invokes custom operation (defined in vtiger_ws_operation table)

Parameters:
  • $operation
  • $params
  • $method
Returns:

array Result object

runQuery($query)

VTiger provides a simple query language for fetching data. This language is quite similar to select queries in SQL. There are limitations, the queries work on a single Module, embedded queries are not supported, and does not support joins. But this is still a powerful way of getting data from Vtiger. Query always limits its output to 100 records, Client application can use limit operator to get different records.

Parameters:
  • $query
Returns:

array Query results

getCurrentUser()

Gets an array containing the basic information about current API user

Returns:array Basic information about current API user
getVtigerInfo()

Gets an array containing the basic information about the connected vTiger instance

Returns:array Basic information about the connected vTiger instance

Salaros\Vtiger\VTWSCLib\WSException

class WSException

Vtiger Web Services PHP Client Exception class

Class WSException

property message

protected

property code

protected

property file

protected

property line

protected

__construct($message, $code = 'UNKNOWN', Exception $previous = null)

Redefine the exception so message isn’t optional

Parameters:
  • $message
  • $code
  • $previous (Exception) –
__toString()

Custom string representation of object

Returns:string A custom string representation of exception
getIterator()

Retrieve an external iterator

Returns:Traversable An instance of an object implementing Traversable
getAllProperties()

Gets all the properties of the object

Returns:array Array of properties
__clone()
__wakeup()
getMessage()
getCode()
getFile()
getLine()
getTrace()
getPrevious()
getTraceAsString()