ArangoDB-PHP API Documentation
  • Namespace
  • Class
  • Deprecated

Namespaces

  • triagens
    • ArangoDb

Classes

  • AdminHandler
  • AqlUserFunction
  • Autoloader
  • Batch
  • BatchPart
  • BindVars
  • Collection
  • CollectionHandler
  • Connection
  • ConnectionOptions
  • Cursor
  • Database
  • DefaultValues
  • Document
  • DocumentHandler
  • Edge
  • EdgeDefinition
  • EdgeHandler
  • Endpoint
  • Export
  • ExportCursor
  • Graph
  • GraphHandler
  • Handler
  • HttpHelper
  • HttpResponse
  • QueryCacheHandler
  • QueryHandler
  • Statement
  • TraceRequest
  • TraceResponse
  • Transaction
  • Traversal
  • UpdatePolicy
  • UrlHelper
  • Urls
  • User
  • UserHandler
  • ValueValidator
  • Vertex
  • VertexHandler

Exceptions

  • ClientException
  • ConnectException
  • Exception
  • ServerException

Class Connection

Provides access to the ArangoDB server

As all access is done using HTTP, we do not need to establish a persistent connection and keep its state.
Instead, connections are established on the fly for each request and are destroyed afterwards.

Namespace: triagens\ArangoDb
Package: triagens\ArangoDb
Since: 0.2
Located at Connection.php

Methods summary

public
# __construct( array $options )

Set up the connection object, validate the options provided

Set up the connection object, validate the options provided

Parameters

$options
  • initial connection options

Throws

triagens\ArangoDb\Exception
public
# __destruct( )

Close existing connection handle if a keep-alive connection was used

Close existing connection handle if a keep-alive connection was used

public
# setOption( string $name, string $value )

Set an option set for the connection

Set an option set for the connection

Parameters

$name
  • name of option
$value
  • value of option

Throws

triagens\ArangoDb\ClientException
public triagens\ArangoDb\ConnectionOptions
# getOptions( )

Get the options set for the connection

Get the options set for the connection

Returns

triagens\ArangoDb\ConnectionOptions
public mixed
# getOption( string $name )

Get an option set for the connection

Get an option set for the connection

Parameters

$name
  • name of option

Returns

mixed

Throws

triagens\ArangoDb\ClientException
public triagens\ArangoDb\HttpResponse
# get( string $url, array $customHeaders = [] )

Issue an HTTP GET request

Issue an HTTP GET request

Parameters

$url
  • GET URL
$customHeaders

Returns

triagens\ArangoDb\HttpResponse

Throws

triagens\ArangoDb\Exception
public triagens\ArangoDb\HttpResponse
# post( string $url, string $data, array $customHeaders = [] )

Issue an HTTP POST request with the data provided

Issue an HTTP POST request with the data provided

Parameters

$url
  • POST URL
$data
  • body to post
$customHeaders

Returns

triagens\ArangoDb\HttpResponse

Throws

triagens\ArangoDb\Exception
public triagens\ArangoDb\HttpResponse
# put( string $url, string $data, array $customHeaders = [] )

Issue an HTTP PUT request with the data provided

Issue an HTTP PUT request with the data provided

Parameters

$url
  • PUT URL
$data
  • body to post
$customHeaders

Returns

triagens\ArangoDb\HttpResponse

Throws

triagens\ArangoDb\Exception
public triagens\ArangoDb\HttpResponse
# head( string $url, array $customHeaders = [] )

Issue an HTTP Head request with the data provided

Issue an HTTP Head request with the data provided

Parameters

$url
  • PUT URL
$customHeaders

Returns

triagens\ArangoDb\HttpResponse

Throws

triagens\ArangoDb\Exception
public triagens\ArangoDb\HttpResponse
# patch( string $url, string $data, array $customHeaders = [] )

Issue an HTTP PATCH request with the data provided

Issue an HTTP PATCH request with the data provided

Parameters

$url
  • PATCH URL
$data
  • patch body
$customHeaders

Returns

triagens\ArangoDb\HttpResponse

Throws

triagens\ArangoDb\Exception
public triagens\ArangoDb\HttpResponse
# delete( string $url, array $customHeaders = [] )

Issue an HTTP DELETE request with the data provided

Issue an HTTP DELETE request with the data provided

Parameters

$url
  • DELETE URL
$customHeaders

Returns

triagens\ArangoDb\HttpResponse

Throws

triagens\ArangoDb\Exception
public triagens\ArangoDb\HttpResponse
# parseResponse( triagens\ArangoDb\HttpResponse $response )

Parse the response return the body values as an assoc array

Parse the response return the body values as an assoc array

Parameters

$response
  • the response as supplied by the server

Returns

triagens\ArangoDb\HttpResponse

Throws

triagens\ArangoDb\Exception
public triagens\ArangoDb\Batch
# stopCaptureBatch( )

Stop capturing commands

Stop capturing commands

Returns

triagens\ArangoDb\Batch
  • Returns the active batch object
public triagens\ArangoDb\Batch
# setActiveBatch( triagens\ArangoDb\Batch $batch )

Sets the active Batch for this connection

Sets the active Batch for this connection

Parameters

$batch
  • Sets the given batch as active

Returns

triagens\ArangoDb\Batch
active batch
public triagens\ArangoDb\Batch
# getActiveBatch( )

returns the active batch

returns the active batch

Returns

triagens\ArangoDb\Batch
active batch
public
# setCaptureBatch( boolean $state )

Sets the batch capture state (true, if capturing)

Sets the batch capture state (true, if capturing)

Parameters

$state
true to turn on capture batch mode, false to turn it off
public
# setBatchRequest( boolean $state )

Sets connection into Batch-request mode. This is needed for some operations to act differently when in this mode.

Sets connection into Batch-request mode. This is needed for some operations to act differently when in this mode.

Parameters

$state
sets the connection state to batch request, meaning it is currently doing a batch request.
public boolean
# isInBatchCaptureMode( )

Returns true if this connection is in Batch-Capture mode

Returns true if this connection is in Batch-Capture mode

Returns

boolean
public
# getBatches( )

returns the active batch

returns the active batch

public static boolean
# detect_utf( array $string )

This function checks that the encoding of a string is utf. It only checks for printable characters.

This function checks that the encoding of a string is utf. It only checks for printable characters.

Parameters

$string
the data to check

Returns

boolean
true if string is UTF-8, false if not
public static
# check_encoding( array $data )

This function checks that the encoding of the keys and values of the array are utf-8, recursively. It will raise an exception if it encounters wrong encoded strings.

This function checks that the encoding of the keys and values of the array are utf-8, recursively. It will raise an exception if it encounters wrong encoded strings.

Parameters

$data
the data to check

Throws

triagens\ArangoDb\ClientException
public string
# json_encode_wrapper( mixed $data, mixed $options = null )

This is a json_encode() wrapper that also checks if the data is utf-8 conform. internally it calls the check_encoding() method. If that method does not throw an Exception, this method will happily return the json_encoded data.

This is a json_encode() wrapper that also checks if the data is utf-8 conform. internally it calls the check_encoding() method. If that method does not throw an Exception, this method will happily return the json_encoded data.

Parameters

$data
the data to encode
$options
the options for the json_encode() call

Returns

string
the result of the json_encode

Throws

triagens\ArangoDb\ClientException
public
# setDatabase( string $database )

Set the database to use with this connection

Set the database to use with this connection

Sets the database to use with this connection, for example: 'my_database'
Further calls to the database will be addressed to the given database.

Parameters

$database
the database to use
public string
# getDatabase( )

Get the database that is currently used with this connection

Get the database that is currently used with this connection

Get the database to use with this connection, for example: 'my_database'

Returns

string
ArangoDB-PHP API Documentation API documentation generated by ApiGen