Download the PHP package enepochatova/influxdb-orm without Composer
On this page you can find all versions of the php package enepochatova/influxdb-orm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download enepochatova/influxdb-orm
More information about enepochatova/influxdb-orm
Files in enepochatova/influxdb-orm
Package influxdb-orm
Short Description The PHP library which helps to convert entities to InfluxDB points and back. Uses annotations for entities configuration.
License MIT
Informations about the package influxdb-orm
InfluxDB ORM
The PHP library which helps to convert entities to InfluxDB points and back. Uses annotations for entities configuration. For better understanding of key concepts please check the official InfluxDB documentation.
Installation
Getting started
Create entity to be stored in DB. Give it the Measurement annotation. The name property of annotation is required.
Then add some properties to class and annotations for them. The annotations for properties are:
- Value: Must be given to numeric property and be unique among class hierarchy. If this annotation is not given to any property of class hierarchy, it will be equal to null and the field 'value' will not be created.
- Field: Has required key property, which is very similar to column name in relational DB.
- Tag: Has required key and optional type properties. By default type is "string". The other valid values are: "int", "float", "bool". Be attended that tags are always stored as strings in DB. That's why we need to specify the original type of class property for convert it back and build entity correctly after we got data from DB.
- ArrayOfMetrics: Must be given to property which contains one-dimensional associative array. This annotation must be unique among class hierarchy. Array values will be stored in DB as fields with appropriate keys.
-
Timestamp: Must be given to numeric property and be unique among class hierarchy. If this annotation is not given to any property of class hierarchy, it will be equal to null and the point will be stored with current server timestamp.
Example:
Also it is possible to map inherited classes. The reading of annotations starts from the target class and goes to its parents. Annotations from children classes have higher priority.
After the entity is done, we need to create the Repository class which extends BaseRepository from this library:
That's it!
Now you are ready to use it like:
Enjoy!