Download the PHP package javer/influxdb-odm without Composer

On this page you can find all versions of the php package javer/influxdb-odm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package influxdb-odm

InfluxDB Object Document Mapper (ODM)

The InfluxDB ODM is a library that provides a PHP object mapping functionality for InfluxDB.

Build Status

Installation

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Open a command console, enter your project directory and execute:

Usage

The best way to understand the InfluxDB ODM is to see it in action. In this section, you'll walk through each step needed to start persisting measurements to and from InfluxDB.

Create a Measurement Class with Mapping Information

Doctrine allows you to work with InfluxDB in a much more interesting way than just fetching data back and forth as an array. Instead, Doctrine allows you to persist entire objects to InfluxDB and fetch entire objects out of InfluxDB. This works by mapping a PHP class and its properties to entries of a InfluxDB Measurement.

For Doctrine to be able to do this, you have to create "metadata", or configuration that tells Doctrine exactly how the CpuLoad class and its properties should be mapped to InfluxDB. This metadata can be specified directly inside the CpuLoad class via annotations:

or using PHP 8 Attributes:

Create Measurement Manager

If you are not using JaverInfluxDBBundle, you have to create an instance of MeasurementManager:

To be able to use annotations, you will have to install an extra package called doctrine/annotations.

Using PHP 8 Attributes:

Persisting Objects to InfluxDB

Now that you have a mapped CpuLoad measurement complete with getter and setter methods, you're ready to persist data to InfluxDB:

Fetching Objects from InfluxDB

Fetching an object back out of InfluxDB is also possible:

When you query for a particular type of object, you always use what's known as its "repository". You can think of a repository as a PHP class whose only job is to help you fetch objects of a certain class. You can access the repository object for a measurement class via:

Once you have your repository, you have access to all sorts of helpful methods:

You can also take advantage of the useful findBy() and findOneBy() methods to easily fetch objects based on multiple conditions:

Updating an Object

Once you've fetched an object from Doctrine, let's try to update it.

Please note that you cannot update value of Timestamp or Tag field, only simple Field can be updated.

Deleting an Object

Deleting an object is very similar, but requires a call to the remove() method of the measurement manager:

Querying for Objects

As you saw above, the built-in repository class allows you to query for one or many objects based on any number of different parameters. When this is enough, this is the easiest way to query for measurements. You can also create more complex queries.

Using the Query Builder

InfluxDB ODM ships with a query "Builder" object, which allows you to construct a query for exactly which measurements you want to return. If you use an IDE, you can also take advantage of auto-completion as you type the method names. From inside a controller:

Custom Repository Classes

In the previous section, you began constructing and using more complex queries from inside a controller. In order to isolate, test and reuse these queries, it's a good idea to create a custom repository class for your measurement and add methods with your query logic there.

To do this, add the name of the repository class to your mapping definition.

You have to create the repository in the namespace indicated above. Make sure it extends the default MeasurementRepository. Next, add a new method - findAllOrderedByTimeDesc() - to the new repository class. This method will query for all of the CpuLoad measurements, ordered by time desc.

You can use this new method like the default finder methods of the repository:

When using a custom repository class, you still have access to the default finder methods such as find() and findAll().


All versions of influxdb-odm with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
doctrine/instantiator Version ^1.3.1 || ^2.0
doctrine/persistence Version ^3.0
influxdb/influxdb-php Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package javer/influxdb-odm contains the following files

Loading the files please wait ....