<commit_before># Query

![Build Status](http://img.shields.io/travis/formativ/query.svg?style=flat-square)
![Code Quality](http://img.shields.io/scrutinizer/g/formativ/query.svg?style=flat-square)
![Code Coverage](http://img.shields.io/scrutinizer/coverage/g/formativ/query.svg?style=flat-square)
![Version](http://img.shields.io/packagist/v/formativ/query.svg?style=flat-square)
![License](http://img.shields.io/packagist/l/formativ/query.svg?style=flat-square)

A PHP wrapper for [OSQuery](http://osquery.io).

## Example

```php
require "vendor/autoload.php";

use Formativ\Query\BuilderProxy;
use Formativ\Query\RunnerProxy;

$builder = BuilderProxy::select("*")->from("processes")->limit(5);

RunnerProxy::run($builder, function(array $data) {
    // use $data
}, function($error) {
    // log $error
});
```

## Installation

```sh
❯ composer require "formativ/query:*"
```

## Testing

```sh
❯ composer create-project "formativ/query:*" .
❯ vendor/bin/phpunit
```
<commit_msg>Updated examples.<commit_after># Query

![Build Status](http://img.shields.io/travis/formativ/query.svg?style=flat-square)
![Code Quality](http://img.shields.io/scrutinizer/g/formativ/query.svg?style=flat-square)
![Code Coverage](http://img.shields.io/scrutinizer/coverage/g/formativ/query.svg?style=flat-square)
![Version](http://img.shields.io/packagist/v/formativ/query.svg?style=flat-square)
![License](http://img.shields.io/packagist/l/formativ/query.svg?style=flat-square)

A PHP wrapper for [OSQuery](http://osquery.io).

## Example

```php
use Formativ\Query\BuilderProxy;
use Formativ\Query\RunnerProxy;

$builder = BuilderProxy::select("*")->from("processes")->limit(5);

RunnerProxy::run($builder, function(array $data) {
    // use $data
}, function($error) {
    // log $error
});
```

```php
use Formativ\Query\BuilderProxy;
use Formativ\Query\Factory\BuilderFactory;
use Formativ\Query\Factory\RunnerFactory;
use Formativ\Query\RunnerProxy;

class CustomBuilderFactory extends BuilderFactory
{
    public function newInstance()
    {
        // ...
    }
}

$builder = BuilderProxy::with(new CustomBuilderFactory())->select("*")->from("processes")->limit(5);

class CustomRunnerFactory extends RunnerFactory
{
    public function newInstance()
    {
        // ...
    }
}

RunnerProxy::with(new CustomRunnerFactory())->run($builder, function(array $data) {
    // use $data
}, function($error) {
    // log $error
});
```

```php
use Aura\SqlQuery\Quoter;
use Aura\SqlQuery\Sqlite\Select;
use Formativ\Query\Builder\AuraBuilder;
use Formativ\Query\Factory\ProcessFactory;
use Formativ\Query\Runner\ProcessRunner;

$builder = new AuraBuilder(new Select(new Quoter('"', '"')));

class CustomProcessFactory extends ProcessFactory
{
    public function newInstance()
    {
        // ...
    }
}

$runner = new ProcessRunner(new CustomProcessFactory());

$runner->run($builder);
```

## Installation

```sh
❯ composer require "formativ/query:*"
```

## Testing

```sh
❯ composer create-project "formativ/query:*" .
❯ vendor/bin/phpunit
```

{'fraction_non_alphanumeric': 0.18385502471169687, 'fraction_numerical': 0.0009884678747940692, 'mean_word_length': 4.827255278310941, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2292850', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1034, 'n_words': 156}