Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ytake/php-presto-client
prestdb client for php
https://github.com/ytake/php-presto-client
facebook php7 prestodb
Last synced: 18 days ago
JSON representation
prestdb client for php
- Host: GitHub
- URL: https://github.com/ytake/php-presto-client
- Owner: ytake
- License: bsd-3-clause
- Created: 2017-06-18T16:38:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-25T11:01:00.000Z (8 months ago)
- Last Synced: 2024-10-04T13:40:31.082Z (about 2 months ago)
- Topics: facebook, php7, prestodb
- Language: PHP
- Size: 33.2 KB
- Stars: 17
- Watchers: 5
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ytake\PrestoClient
[![Build Status](http://img.shields.io/travis/ytake/php-presto-client/master.svg?style=flat-square)](https://travis-ci.org/ytake/php-presto-client)
[![Coverage Status](http://img.shields.io/coveralls/ytake/php-presto-client/master.svg?style=flat-square)](https://coveralls.io/r/ytake/php-presto-client?branch=master)
[![Scrutinizer Code Quality](http://img.shields.io/scrutinizer/g/ytake/php-presto-client.svg?style=flat-square)](https://scrutinizer-ci.com/g/ytake/php-presto-client/?branch=master)[![License](http://img.shields.io/packagist/l/ytake/php-presto-client.svg?style=flat-square)](https://packagist.org/packages/ytake/php-presto-client)
[![Latest Version](http://img.shields.io/packagist/v/ytake/php-presto-client.svg?style=flat-square)](https://packagist.org/packages/ytake/php-presto-client)
[![Total Downloads](http://img.shields.io/packagist/dt/ytake/php-presto-client.svg?style=flat-square)](https://packagist.org/packages/ytake/php-presto-client)
[![StyleCI](https://styleci.io/repos/94699825/shield?branch=master)](https://styleci.io/repos/94699825)[![SensioLabsInsight](https://insight.sensiolabs.com/projects/9a13a5c0-7588-459f-835e-d73dabd22843/mini.png)](https://insight.sensiolabs.com/projects/9a13a5c0-7588-459f-835e-d73dabd22843)
prestodb http protocol client for php
[prestodb](https://prestodb.io/)
## What is Presto
Presto is an open source distributed SQL query engine for running interactive analytic queries against data sources of all sizes ranging from gigabytes to petabytes.
## Install
*required >= PHP 7.0*
```bash
$ composer require ytake/php-presto-client
```## Usage
### Standard
```php
execute();
// next call uri
$client->advance();/** @var \Ytake\PrestoClient\QueryResult $result */
// current result
$result = $client->current();// request cancel
$client->cancelLeafStage();
```### bulk operations
```php
execute()->yieldResults();// array
$result = $resultSession->execute()->getResults();
```## Fetch Styles
### FixData Object
```php
execute()->yieldResults();
/** @var \Ytake\PrestoClient\QueryResult $row */
foreach ($result as $row) {
foreach ($row->yieldData() as $yieldRow) {
if ($yieldRow instanceof \Ytake\PrestoClient\FixData) {
var_dump($yieldRow->offsetGet('column_name'), $yieldRow['column_name']);
}
}
}
```### Array Keys
```php
execute()->yieldResults();
/** @var \Ytake\PrestoClient\QueryResult $row */
foreach ($result as $row) {
/** @var array $item */
foreach ($row->yieldDataArray() as $item) {
if (!is_null($item)) {
var_dump($item);
}
}
}
```### Mapping Class
```php
execute()->yieldResults();
/** @var \Ytake\PrestoClient\QueryResult $row */
foreach ($result as $row) {
foreach($row->yieldObject(Testing::class) as $object) {
if ($object instanceof Testing) {
var_dump($object);
}
}
}
```