PHP Class InfluxDB\Client

Show file Open project: influxdb/influxdb-php Class Usage Examples

Public Properties

Property Type Description
$admin InfluxDB\Client\Admin
$lastQuery null Stores the last query that ran

Protected Properties

Property Type Description
$baseURI
$driver InfluxDB\Driver\DriverInterface
$host string
$options array
$password string
$port integer
$scheme boolean
$timeout float
$udpPort integer
$useUdp boolean
$username string
$verifySSL boolean

Public Methods

Method Description
__construct ( string $host, integer $port = 8086, string $username = '', string $password = '', boolean $ssl = false, boolean $verifySSL = false, integer $timeout )
fromDSN ( string $dsn, integer $timeout, boolean $verifySSL = false ) : Client | Database Build the client from a dsn Examples:
getBaseURI ( ) : mixed
getDriver ( ) : InfluxDB\Driver\DriverInterface | InfluxDB\Driver\QueryDriverInterface
getHost ( ) : string
getLastQuery ( ) : null | string Returns the last executed query
getTimeout ( ) : float
listDatabases ( ) List all the databases
listUsers ( ) : array List all the users
query ( string $database, string $query, array $parameters = [] ) : influxdb\ResultSet Query influxDB
selectDB ( string $name ) : Database Use the given database
setDriver ( InfluxDB\Driver\DriverInterface $driver )
write ( array $parameters, string | array $payload ) : boolean Write data

Protected Methods

Method Description
pointsToArray ( array $points ) : array

Method Details

__construct() public method

public __construct ( string $host, integer $port = 8086, string $username = '', string $password = '', boolean $ssl = false, boolean $verifySSL = false, integer $timeout )
$host string
$port integer
$username string
$password string
$ssl boolean
$verifySSL boolean
$timeout integer

fromDSN() public static method

https+influxdb://username:pass@localhost:8086/databasename udp+influxdb://username:pass@localhost:4444/databasename
public static fromDSN ( string $dsn, integer $timeout, boolean $verifySSL = false ) : Client | Database
$dsn string
$timeout integer
$verifySSL boolean
return Client | Database

getBaseURI() public method

public getBaseURI ( ) : mixed
return mixed

getDriver() public method

public getDriver ( ) : InfluxDB\Driver\DriverInterface | InfluxDB\Driver\QueryDriverInterface
return InfluxDB\Driver\DriverInterface | InfluxDB\Driver\QueryDriverInterface

getHost() public method

public getHost ( ) : string
return string

getLastQuery() public method

Returns the last executed query
public getLastQuery ( ) : null | string
return null | string

getTimeout() public method

public getTimeout ( ) : float
return float

listDatabases() public method

List all the databases
public listDatabases ( )

listUsers() public method

List all the users
public listUsers ( ) : array
return array

pointsToArray() protected method

protected pointsToArray ( array $points ) : array
$points array
return array

query() public method

Query influxDB
public query ( string $database, string $query, array $parameters = [] ) : influxdb\ResultSet
$database string
$query string
$parameters array
return influxdb\ResultSet

selectDB() public method

Use the given database
public selectDB ( string $name ) : Database
$name string
return Database

setDriver() public method

public setDriver ( InfluxDB\Driver\DriverInterface $driver )
$driver InfluxDB\Driver\DriverInterface

write() public method

Write data
public write ( array $parameters, string | array $payload ) : boolean
$parameters array
$payload string | array InfluxDB payload (Or array of payloads) that conform to the Line syntax.
return boolean

Property Details

$admin public property

public Admin,InfluxDB\Client $admin
return InfluxDB\Client\Admin

$baseURI protected property

protected $baseURI

$driver protected property

protected DriverInterface,InfluxDB\Driver $driver
return InfluxDB\Driver\DriverInterface

$host protected property

protected string $host
return string

$lastQuery public static property

Stores the last query that ran
public static null $lastQuery
return null

$options protected property

protected array $options
return array

$password protected property

protected string $password
return string

$port protected property

protected int $port
return integer

$scheme protected property

protected bool $scheme
return boolean

$timeout protected property

protected float $timeout
return float

$udpPort protected property

protected int $udpPort
return integer

$useUdp protected property

protected bool $useUdp
return boolean

$username protected property

protected string $username
return string

$verifySSL protected property

protected bool $verifySSL
return boolean