Download the PHP package r4j4h/php-druid-query without Composer

On this page you can find all versions of the php package r4j4h/php-druid-query. 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 php-druid-query

php-druid-query

PHP wrapper around executing HTTP requests to Druid. Usually this will be for queries, but can be used for other purposes (such as ingestion).

Overview

The wrapper lives in the namespace DruidFamiliar. Druid itself was named in the sprit of the D&D character, and that character could have a familiar - a spiritually linked animal companion. This wrapper in a sense lives as a companion to Druid, and thus the name.

I think the repo name should reflect the namespace for clarity, it currently is php-druid-query while the namespace is DruidFamiliar. This would be pretty breaking change and will be saved for the future. If you have other suggestions for naming of project or namespaces, feel free to suggest before then.

Changelog

0.2.1

0.2.0 Major refactoring

0.1.0 Initial release

Typical Use

In general, this wrapper's purpose is to streamline the execution of queries by encapsulating the cruft from the HTTP nature of Druid and the analytical grammar in query configuration.

  1. Instantiate a connection, configured to hit a Druid endpoint.
  2. Instantiate a query generator object for the desired query.
  3. Instantiate a query parameters object, configured with desired query parameters.
  4. Instantiate a result handler to format the results (otherwise use DoNothingResponseHandler)
  5. Combine the connection, query, parameters, and response handler to execute it, getting the result from the result handler.

Interface wise, this looks like:

  1. Instantiate a IDruidQueryExecutor, configured to hit a Druid endpoint.
  2. Instantiate a IDruidQueryGenerator.
  3. Instantiate a IDruidQueryParameters, configured with parameters.
  4. Instantiate a IDruidQueryResponseHandler.
  5. Run the IDruidQueryExecutor's executeQuery function with the IDruidQueryGenerator, IDruidQueryParameters, and the IDruidQueryResponseHandler, getting the result from the IDruidQueryResponseHandler.

Implementation wise, this can look like:

  1. Instantiate a DruidNodeDruidQueryExecutor, configured to hit a Druid endpoint.
  2. Instantiate a SegmentMetadataDruidQuery.
  3. Instantiate a SegmentMetadataDruidQueryParameters, configured with parameters.
  4. Instantiate a SegmentMetadataResponseHandler.
  5. Run the DruidNodeDruidQueryExecutor's executeQuery function with the classes spawned in the previous steps, getting the result from SegmentMetadataResponseHandler.

How to Install

Right now, there is no tagged version. To be ready for it when it comes, branch-aliases are in place.

To install, it is suggested to use Composer. If you have it installed, then the following instructions in a composer.json should be all you need to get started:

Once that is in, composer install and composer update should work.

Once those are run, require Composer's autoloader and you are off to the races, or tree circles as it were (bad Druid reference):

  1. require 'vendor/autoload.php';
  2. $yay = new \DruidFamiliar\Query\TimeBoundaryDruidQuery('my-cool-data-source');
  3. Refer to the Typical Use section above.

How to Test

Once composer install has finished, from the root directory in a command terminal run:

vendor/bin/phing

or

vendor/bin/phpunit tests

Generate Documentation

From the root directory, in a command terminal run: php vendor/bin/phing docs.

Examples

Examples are located in the \examples folder.

They share connection information from _examples-config.php. Change that match your Druid instance's connection info.

Right now most are designed to run via the CLI, but will work in a browser if a web server running php serves them.

The HTML outputting ones should print the query results to HTML:

How it Works & How to Extend

Please refer to this diagram for an overview of how this works underneath the hood.

(From this Dynamic LucidChart Source URL)

In general, to add support for a new query all you need to do is create a new class wherever you want that implements IDruidQuery.

By wherever you want, that could be in a fork of this repo, or outside of this repo using this repo's interfaces. That is up to you. :)

References

Appendix A. Composer.json example that does not rely on Packagist.org:


All versions of php-druid-query with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
guzzle/guzzle Version ~3.9
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 r4j4h/php-druid-query contains the following files

Loading the files please wait ....