Download the PHP package rapiddive/nrql-builder without Composer

On this page you can find all versions of the php package rapiddive/nrql-builder. 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 nrql-builder

NRQL Query Builder

CI

A PHP library for assembling New Relic Query Language (NRQL) queries in object-oriented applications.

The library implements the official NRQL specification and offers a fluent interface to specify query parts in an arbitrary order, allowing different application parts to influence a query without worrying about assembly order. Query integrity validation is performed upon rendering. Object-oriented representations for time expressions enable code completion and avoid typos.

Inspired by upscalesoftware/newrelic-query-builder.

Requirements

Installation

Or add it to composer.json manually:

Usage

Full query

The example below demonstrates a query using all available clauses:

Select all attributes

Use selectAll() as a shorthand for SELECT *:

Time series with auto bucket

Call timeSeries() without a period to let New Relic choose the bucket size automatically:

Reusing a builder as a template

resetPart() clears a single clause so it can be reassigned, letting one builder serve as a base for multiple related queries:

Custom moment types

since(), until(), and compareWith() accept any implementation of MomentInterface, so you can define time expressions beyond the built-in TimeAgo, Yesterday, and ExactTime:

API Reference

QueryBuilder clauses

Method NRQL clause Notes
select(array $attributes) SELECT a, b Comma-joins the array
selectAll() SELECT * Shorthand for wildcard
from(array $events) FROM Event Comma-joins the array
where(string $conditions) WHERE ... Raw condition string
facet(string $attribute) FACET attr Raw attribute string
limit(int $count) LIMIT N Throws on values < 1
since(MomentInterface) SINCE ...
until(MomentInterface) UNTIL ...
compareWith(MomentInterface) COMPARE WITH ... Requires SINCE or UNTIL
timeSeries(?TimePeriod, string $default='AUTO') TIMESERIES ... null period uses $default
withTimeZone(?string $timezone) WITH TIMEZONE 'tz' Value is auto-quoted
resetPart(string $part) Clears a clause for reassignment

Use the QueryBuilder::PART_* constants (e.g. QueryBuilder::PART_WHERE) when calling resetPart().

Time expressions (Moment)

Class Renders as Constructor
TimeAgo N unit AGO new TimeAgo(new TimePeriod(4, TimePeriod::UNIT_DAYS))
Yesterday YESTERDAY new Yesterday()
ExactTime 'Y-m-d H:i:s T' new ExactTime(new Carbon('2024-01-01', 'UTC'))

TimePeriod units

TimePeriod::UNIT_MINUTES, UNIT_HOURS, UNIT_DAYS, UNIT_WEEKS

Limitations

Some complex aspects of the NRQL syntax have not been implemented in an object-oriented manner. These include Aggregator Functions, Math Operators, and logical operators (AND, OR, grouping). The library accommodates these as free-format string arguments to select(), where(), and facet().

License

Licensed under the Apache License, Version 2.0.


All versions of nrql-builder with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
nesbot/carbon Version ^3.11
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 rapiddive/nrql-builder contains the following files

Loading the files please wait ...